-- Services local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") -- Variables local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local swimming = false local swimSpeed = 25 -- Adjust swim speed as needed -- GUI Setup local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "SwimGui" ScreenGui.Parent = player.PlayerGui local SwimButton = Instance.new("TextButton") SwimButton.Size = UDim2.new(0, 100, 0, 30) SwimButton.Position = UDim2.new(0, 10, 0, 10) SwimButton.Text = "Swim" SwimButton.BackgroundColor3 = Color3.new(0, 0.5, 1) SwimButton.Parent = ScreenGui -- Swim Function local function ToggleSwim() swimming = not swimming humanoid.Swimming = swimming if swimming then SwimButton.Text = "Stop Swimming" humanoid.WalkSpeed = swimSpeed humanoid.JumpPower = 0 else SwimButton.Text = "Swim" humanoid.WalkSpeed = 16 -- Restore walkspeed humanoid.JumpPower = 50 -- Restore jumppower end end -- Button Clicked Event SwimButton.MouseButton1Click:Connect(ToggleSwim) -- Keybind (optional) UserInputService.InputBegan:Connect(function(input, gameProcessedEvent) if gameProcessedEvent then return end if input.KeyCode == Enum.KeyCode.V then -- Change "V" to your desired key ToggleSwim() end end) -- Movement while swimming RunService.RenderStepped:Connect(function(deltaTime) if swimming then local direction = Vector3.new(0,0,0) if UserInputService:IsKeyDown(Enum.KeyCode.W) then direction = direction + character.HumanoidRootPart.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.S) then direction = direction - character.HumanoidRootPart.CFrame.LookVector end if UserInputService:IsKeyDown(Enum.KeyCode.A) then direction = direction - character.HumanoidRootPart.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.D) then direction = direction + character.HumanoidRootPart.CFrame.RightVector end if UserInputService:IsKeyDown(Enum.KeyCode.Space) then direction = direction + Vector3.new(0,1,0) end if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then direction = direction - Vector3.new(0,1,0) end character:MoveTo(character.HumanoidRootPart.Position + direction * swimSpeed * deltaTime) end end)