--[[ Swim Fly Controller (FIXED) - Uses Roblox Humanoid Swimming movement in the air. - Keeps normal Roblox-style swimming controls. - Dark blue ImGui-style GUI. - Speed is controlled with a GUI slider. - Fixed CFrame teleport added underneath the speed slider. - Teleport destination cannot be changed from the GUI. - Usage note shown at the bottom of the GUI. FIXES APPLIED: 1. Removed double speed multiplication (velocity was being squared). 2. Stopped fighting the Humanoid controller — WalkSpeed now drives movement while Swimming, velocity is no longer hand-set every frame. 3. Replaced GettingUp state on toggle-off with Freefall (correct for mid-air/mid-water disable). 4. Added Touch input support alongside MouseButton1 for dragging and the slider, so it works on mobile. ]] local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local root = character:WaitForChild("HumanoidRootPart") -- Configuration local ENABLED_DEFAULT = false local MIN_SPEED = 8 local MAX_SPEED = 200 local DEFAULT_SPEED = 50 -- Fixed teleport destination local TELEPORT_CFRAME = CFrame.new( -1350.36, 252.64, -833.43 ) -- UI Colors local COLORS = { Background = Color3.fromRGB(12, 18, 30), Panel = Color3.fromRGB(17, 25, 40), Header = Color3.fromRGB(20, 42, 72), Section = Color3.fromRGB(15, 32, 54), Button = Color3.fromRGB(24, 48, 78), ButtonHover = Color3.fromRGB(31, 65, 105), Accent = Color3.fromRGB(45, 130, 220), AccentLight = Color3.fromRGB(80, 165, 245), Border = Color3.fromRGB(45, 78, 115), Text = Color3.fromRGB(225, 235, 245), TextDim = Color3.fromRGB(145, 165, 190), Success = Color3.fromRGB(80, 220, 145), Error = Color3.fromRGB(255, 100, 110) } -- State variables local isFlyingEnabled = ENABLED_DEFAULT local swimSpeed = DEFAULT_SPEED local oldWalkSpeed = humanoid.WalkSpeed local oldAutoRotate = humanoid.AutoRotate ------------------------------------------------------------------------------- -- 1. Build GUI ------------------------------------------------------------------------------- local GuiLayer = Instance.new("ScreenGui") GuiLayer.Name = "SOLEY" GuiLayer.ResetOnSpawn = false GuiLayer.IgnoreGuiInset = true -- Destroy any old copy of the GUI still sitting in PlayerGui from a -- previous run, so re-executing the script doesn't stack duplicate -- GUIs or leave a stale one visible. local existingGui = player.PlayerGui:FindFirstChild("SOLEY") if existingGui then existingGui:Destroy() end GuiLayer.Parent = player:WaitForChild("PlayerGui") local MainFrame = Instance.new("Frame") MainFrame.Size = UDim2.new(0, 300, 0, 265) MainFrame.Position = UDim2.new(0.5, -150, 0.5, -132) MainFrame.BackgroundColor3 = COLORS.Background MainFrame.BorderSizePixel = 1 MainFrame.BorderColor3 = COLORS.Border MainFrame.Active = true MainFrame.ClipsDescendants = true MainFrame.Parent = GuiLayer local BackgroundImage = Instance.new("ImageLabel") BackgroundImage.Name = "Background" BackgroundImage.Size = UDim2.new(1, 0, 1, 0) BackgroundImage.Position = UDim2.new(0, 0, 0, 0) BackgroundImage.BackgroundTransparency = 1 BackgroundImage.Image = "rbxassetid://469317097" BackgroundImage.ImageTransparency = 0.75 BackgroundImage.ScaleType = Enum.ScaleType.Crop BackgroundImage.ZIndex = 0 BackgroundImage.Parent = MainFrame ------------------------------------------------------------------------------- -- 2. Header / Dragging ------------------------------------------------------------------------------- local Header = Instance.new("Frame") Header.Size = UDim2.new(1, 0, 0, 32) Header.BackgroundColor3 = COLORS.Header Header.BorderSizePixel = 0 Header.Active = true Header.Parent = MainFrame local HeaderAccent = Instance.new("Frame") HeaderAccent.Size = UDim2.new(0, 4, 1, 0) HeaderAccent.BackgroundColor3 = COLORS.Accent HeaderAccent.BorderSizePixel = 0 HeaderAccent.Parent = Header local HeaderTitle = Instance.new("TextLabel") HeaderTitle.Size = UDim2.new(1, -15, 1, 0) HeaderTitle.Position = UDim2.new(0, 12, 0, 0) HeaderTitle.BackgroundTransparency = 1 HeaderTitle.Text = "SOLEY (FREE)" HeaderTitle.Font = Enum.Font.Code HeaderTitle.TextSize = 15 HeaderTitle.TextColor3 = COLORS.Text HeaderTitle.TextXAlignment = Enum.TextXAlignment.Left HeaderTitle.Parent = Header local HeaderStatus = Instance.new("TextLabel") HeaderStatus.Size = UDim2.new(0, 65, 1, 0) HeaderStatus.Position = UDim2.new(1, -70, 0, 0) HeaderStatus.BackgroundTransparency = 1 HeaderStatus.Text = "READY" HeaderStatus.Font = Enum.Font.Code HeaderStatus.TextSize = 11 HeaderStatus.TextColor3 = COLORS.Success HeaderStatus.TextXAlignment = Enum.TextXAlignment.Right HeaderStatus.Parent = Header local dragging = false local dragStart = nil local startPosition = nil local function IsPrimaryInput(input) return input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch end Header.InputBegan:Connect(function(input) if IsPrimaryInput(input) then dragging = true dragStart = input.Position startPosition = MainFrame.Position end end) Header.InputEnded:Connect(function(input) if IsPrimaryInput(input) then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch then return end local delta = input.Position - dragStart MainFrame.Position = UDim2.new( startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y ) end) ------------------------------------------------------------------------------- -- 3. Swim Section ------------------------------------------------------------------------------- local SwimSection = Instance.new("Frame") SwimSection.Size = UDim2.new(1, -20, 0, 65) SwimSection.Position = UDim2.new(0, 10, 0, 42) SwimSection.BackgroundColor3 = COLORS.Panel SwimSection.BorderSizePixel = 1 SwimSection.BorderColor3 = COLORS.Border SwimSection.Parent = MainFrame local SwimSectionTitle = Instance.new("TextLabel") SwimSectionTitle.Size = UDim2.new(1, -10, 0, 18) SwimSectionTitle.Position = UDim2.new(0, 7, 0, 3) SwimSectionTitle.BackgroundTransparency = 1 SwimSectionTitle.Text = "MOVEMENT" SwimSectionTitle.Font = Enum.Font.Code SwimSectionTitle.TextSize = 11 SwimSectionTitle.TextColor3 = COLORS.TextDim SwimSectionTitle.TextXAlignment = Enum.TextXAlignment.Left SwimSectionTitle.Parent = SwimSection ------------------------------------------------------------------------------- -- 4. Toggle Button ------------------------------------------------------------------------------- local btnToggle = Instance.new("TextButton") btnToggle.Size = UDim2.new(0, 115, 0, 30) btnToggle.Position = UDim2.new(0, 7, 0, 27) btnToggle.BackgroundColor3 = COLORS.Button btnToggle.BorderSizePixel = 1 btnToggle.BorderColor3 = COLORS.Border btnToggle.Text = "SWIM : OFF" btnToggle.Font = Enum.Font.Code btnToggle.TextSize = 13 btnToggle.TextColor3 = COLORS.Text btnToggle.AutoButtonColor = false btnToggle.Parent = SwimSection ------------------------------------------------------------------------------- -- 5. Speed Display ------------------------------------------------------------------------------- local lblSpeed = Instance.new("TextLabel") lblSpeed.Size = UDim2.new(0, 130, 0, 25) lblSpeed.Position = UDim2.new(0, 140, 0, 29) lblSpeed.BackgroundTransparency = 1 lblSpeed.Text = "SPEED " .. math.floor(swimSpeed) lblSpeed.Font = Enum.Font.Code lblSpeed.TextSize = 13 lblSpeed.TextColor3 = COLORS.Text lblSpeed.TextXAlignment = Enum.TextXAlignment.Left lblSpeed.Parent = SwimSection ------------------------------------------------------------------------------- -- 6. Speed Slider ------------------------------------------------------------------------------- local SliderBack = Instance.new("Frame") SliderBack.Size = UDim2.new(1, -20, 0, 7) SliderBack.Position = UDim2.new(0, 10, 0, 117) SliderBack.BackgroundColor3 = Color3.fromRGB(25, 40, 60) SliderBack.BorderSizePixel = 1 SliderBack.BorderColor3 = COLORS.Border SliderBack.Active = true SliderBack.Parent = MainFrame local SliderFill = Instance.new("Frame") SliderFill.Size = UDim2.new( (swimSpeed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), 0, 1, 0 ) SliderFill.BackgroundColor3 = COLORS.Accent SliderFill.BorderSizePixel = 0 SliderFill.Parent = SliderBack local SliderKnob = Instance.new("Frame") SliderKnob.Size = UDim2.new(0, 12, 0, 15) SliderKnob.AnchorPoint = Vector2.new(0.5, 0.5) SliderKnob.Position = UDim2.new( (swimSpeed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), 0, 0.5, 0 ) SliderKnob.BackgroundColor3 = COLORS.AccentLight SliderKnob.BorderSizePixel = 1 SliderKnob.BorderColor3 = COLORS.Text SliderKnob.Parent = SliderBack local sliderDragging = false local function UpdateSpeed(percent) percent = math.clamp(percent, 0, 1) swimSpeed = MIN_SPEED + ((MAX_SPEED - MIN_SPEED) * percent) SliderFill.Size = UDim2.new( percent, 0, 1, 0 ) SliderKnob.Position = UDim2.new( percent, 0, 0.5, 0 ) lblSpeed.Text = "SPEED " .. math.floor(swimSpeed) -- Keep WalkSpeed synced immediately so slider changes take effect -- even if the player isn't currently pressing a movement key. if isFlyingEnabled then humanoid.WalkSpeed = swimSpeed end end local function UpdateSpeedFromMouse(mouseX) local percent = (mouseX - SliderBack.AbsolutePosition.X) / SliderBack.AbsoluteSize.X UpdateSpeed(percent) end SliderBack.InputBegan:Connect(function(input) if IsPrimaryInput(input) then sliderDragging = true UpdateSpeedFromMouse(input.Position.X) end end) SliderBack.InputEnded:Connect(function(input) if IsPrimaryInput(input) then sliderDragging = false end end) UserInputService.InputChanged:Connect(function(input) if sliderDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then UpdateSpeedFromMouse(input.Position.X) end end) ------------------------------------------------------------------------------- -- 7. Teleport Section ------------------------------------------------------------------------------- local TeleportSection = Instance.new("Frame") TeleportSection.Size = UDim2.new(1, -20, 0, 82) TeleportSection.Position = UDim2.new(0, 10, 0, 133) TeleportSection.BackgroundColor3 = COLORS.Panel TeleportSection.BorderSizePixel = 1 TeleportSection.BorderColor3 = COLORS.Border TeleportSection.Parent = MainFrame local TeleportTitle = Instance.new("TextLabel") TeleportTitle.Size = UDim2.new(1, -10, 0, 18) TeleportTitle.Position = UDim2.new(0, 7, 0, 3) TeleportTitle.BackgroundTransparency = 1 TeleportTitle.Text = "FIXED TELEPORT" TeleportTitle.Font = Enum.Font.Code TeleportTitle.TextSize = 11 TeleportTitle.TextColor3 = COLORS.TextDim TeleportTitle.TextXAlignment = Enum.TextXAlignment.Left TeleportTitle.Parent = TeleportSection local TeleportDestination = Instance.new("TextLabel") TeleportDestination.Size = UDim2.new(1, -15, 0, 17) TeleportDestination.Position = UDim2.new(0, 7, 0, 20) TeleportDestination.BackgroundTransparency = 1 TeleportDestination.Text = "X -1350.36 Y 252.64 Z -833.43" TeleportDestination.Font = Enum.Font.Code TeleportDestination.TextSize = 10 TeleportDestination.TextColor3 = COLORS.TextDim TeleportDestination.TextXAlignment = Enum.TextXAlignment.Left TeleportDestination.Parent = TeleportSection local btnTeleport = Instance.new("TextButton") btnTeleport.Size = UDim2.new(0, 170, 0, 30) btnTeleport.Position = UDim2.new(0, 7, 0, 45) btnTeleport.BackgroundColor3 = COLORS.Button btnTeleport.BorderSizePixel = 1 btnTeleport.BorderColor3 = COLORS.Border btnTeleport.Text = "TELEPORT" btnTeleport.Font = Enum.Font.Code btnTeleport.TextSize = 13 btnTeleport.TextColor3 = COLORS.Text btnTeleport.AutoButtonColor = false btnTeleport.Parent = TeleportSection local TeleportStatus = Instance.new("TextLabel") TeleportStatus.Size = UDim2.new(0, 85, 0, 30) TeleportStatus.Position = UDim2.new(0, 187, 0, 45) TeleportStatus.BackgroundTransparency = 1 TeleportStatus.Text = "READY" TeleportStatus.Font = Enum.Font.Code TeleportStatus.TextSize = 11 TeleportStatus.TextColor3 = COLORS.Success TeleportStatus.TextXAlignment = Enum.TextXAlignment.Center TeleportStatus.Parent = TeleportSection ------------------------------------------------------------------------------- -- 7b. Usage Note ------------------------------------------------------------------------------- local NoteLabel = Instance.new("TextLabel") NoteLabel.Size = UDim2.new(1, -20, 0, 35) NoteLabel.Position = UDim2.new(0, 10, 0, 221) NoteLabel.BackgroundTransparency = 1 NoteLabel.Text = "How to use: turn on Swim Fly, go up over the floor (not the parkour), then click Teleport — you're good to go <3" NoteLabel.Font = Enum.Font.Code NoteLabel.TextSize = 11 NoteLabel.TextColor3 = COLORS.TextDim NoteLabel.TextWrapped = true NoteLabel.TextXAlignment = Enum.TextXAlignment.Left NoteLabel.TextYAlignment = Enum.TextYAlignment.Top NoteLabel.Parent = MainFrame ------------------------------------------------------------------------------- -- 8. Button Hover Effects ------------------------------------------------------------------------------- btnToggle.MouseEnter:Connect(function() if not isFlyingEnabled then btnToggle.BackgroundColor3 = COLORS.ButtonHover end end) btnToggle.MouseLeave:Connect(function() if not isFlyingEnabled then btnToggle.BackgroundColor3 = COLORS.Button end end) btnTeleport.MouseEnter:Connect(function() btnTeleport.BackgroundColor3 = COLORS.ButtonHover end) btnTeleport.MouseLeave:Connect(function() btnTeleport.BackgroundColor3 = COLORS.Button end) ------------------------------------------------------------------------------- -- 9. Fixed CFrame Teleport Function ------------------------------------------------------------------------------- local TELEPORT_STEPS = 100 -- Number of Lerp steps local TELEPORT_STEP_WAIT = 0.01 -- Seconds between each step local isTeleporting = false local function TeleportToPosition() if isTeleporting then return end if not character or not character.Parent then TeleportStatus.Text = "NO CHARACTER" TeleportStatus.TextColor3 = COLORS.Error return end if not root or not root.Parent then TeleportStatus.Text = "NO ROOT" TeleportStatus.TextColor3 = COLORS.Error return end isTeleporting = true TeleportStatus.Text = "TELEPORTING" TeleportStatus.TextColor3 = COLORS.AccentLight -- Smoothly Lerp the HumanoidRootPart from its current CFrame to the -- fixed teleport CFrame over a series of small steps, rather than -- snapping instantly. local startCFrame = root.CFrame local targetCFrame = TELEPORT_CFRAME for i = 1, TELEPORT_STEPS do -- Bail out early if the character/root disappears mid-teleport -- (e.g. player died or respawned). if not root or not root.Parent then isTeleporting = false TeleportStatus.Text = "NO ROOT" TeleportStatus.TextColor3 = COLORS.Error return end local fraction = i / TELEPORT_STEPS root.CFrame = startCFrame:Lerp(targetCFrame, fraction) task.wait(TELEPORT_STEP_WAIT) end -- Remove leftover movement after teleport. root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero isTeleporting = false TeleportStatus.Text = "TELEPORTED" TeleportStatus.TextColor3 = COLORS.Success task.delay(1.5, function() if TeleportStatus and TeleportStatus.Parent then TeleportStatus.Text = "READY" end end) end btnTeleport.Activated:Connect(function() task.spawn(TeleportToPosition) end) ------------------------------------------------------------------------------- -- 10. Toggle Swimming State ------------------------------------------------------------------------------- local function SetSwimming(enabled) isFlyingEnabled = enabled if enabled then oldWalkSpeed = humanoid.WalkSpeed oldAutoRotate = humanoid.AutoRotate humanoid.AutoRotate = true humanoid.WalkSpeed = swimSpeed humanoid:ChangeState( Enum.HumanoidStateType.Swimming ) btnToggle.Text = "SWIM : ON" btnToggle.BackgroundColor3 = Color3.fromRGB(25, 95, 145) btnToggle.TextColor3 = Color3.fromRGB(225, 245, 255) HeaderStatus.Text = "ACTIVE" HeaderStatus.TextColor3 = COLORS.AccentLight else humanoid.WalkSpeed = oldWalkSpeed humanoid.AutoRotate = oldAutoRotate -- FIX: Use Freefall instead of GettingUp — GettingUp is meant -- for recovering from being knocked down on the ground, and -- looks/behaves wrong when turning swim off mid-air or mid-water. humanoid:ChangeState( Enum.HumanoidStateType.Freefall ) btnToggle.Text = "SWIM : OFF" btnToggle.BackgroundColor3 = COLORS.Button btnToggle.TextColor3 = COLORS.Text HeaderStatus.Text = "READY" HeaderStatus.TextColor3 = COLORS.Success end end btnToggle.Activated:Connect(function() SetSwimming(not isFlyingEnabled) end) ------------------------------------------------------------------------------- -- 11. Actual Roblox-Style Swimming Movement ------------------------------------------------------------------------------- RunService.RenderStepped:Connect(function() if not character.Parent then return end if not isFlyingEnabled then return end -- Keep the Humanoid in Roblox's Swimming state. if humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then humanoid:ChangeState( Enum.HumanoidStateType.Swimming ) end -- FIX: The Humanoid's Swimming state only reliably converts -- WalkSpeed into extra ascend/descend speed when forced mid-air -- (no real water/buoyancy present) — horizontal movement doesn't -- speed up from WalkSpeed alone in this situation. So we drive -- horizontal velocity directly from MoveDirection * swimSpeed -- (previously this had a bug where it was multiplied twice, -- effectively squaring the speed — that's fixed here, it's now -- a single, correct multiplication). humanoid.WalkSpeed = swimSpeed if humanoid.MoveDirection.Magnitude > 0 then local velocity = humanoid.MoveDirection.Unit * swimSpeed -- Preserve whatever vertical velocity the Swimming state -- is already applying (ascend/descend via space/ctrl). root.AssemblyLinearVelocity = Vector3.new( velocity.X, root.AssemblyLinearVelocity.Y, velocity.Z ) else -- Gradually slow horizontal swimming when no movement is pressed. local velocity = root.AssemblyLinearVelocity root.AssemblyLinearVelocity = Vector3.new( velocity.X * 0.92, velocity.Y, velocity.Z * 0.92 ) end end) ------------------------------------------------------------------------------- -- 12. Character Respawn Handling ------------------------------------------------------------------------------- player.CharacterAdded:Connect(function(newCharacter) character = newCharacter humanoid = character:WaitForChild("Humanoid") root = character:WaitForChild("HumanoidRootPart") oldWalkSpeed = humanoid.WalkSpeed oldAutoRotate = humanoid.AutoRotate if isFlyingEnabled then humanoid.AutoRotate = true humanoid.WalkSpeed = swimSpeed humanoid:ChangeState( Enum.HumanoidStateType.Swimming ) end end) ------------------------------------------------------------------------------- -- 13. Initialize ------------------------------------------------------------------------------- SetSwimming(ENABLED_DEFAULT) print("[SOLEY Initialized]") print("Roblox Swimming State = ON") print("Slider = Swimming Speed") print("Drag Header = Move GUI") print("Teleport = Fixed CFrame") print("Teleport CFrame = -1350.36, 252.64, -833.43") print("Teleport Status = READY")