local localPlayer = game:GetService("Players").LocalPlayer local userInputService = game:GetService("UserInputService") local toggle = false local speed = 25 game:GetService("UserInputService").InputBegan:Connect(function(input,processed) if input.KeyCode == Enum.KeyCode.Z and not processed then toggle = not toggle end end) game:GetService("RunService").RenderStepped:Connect(function(delta) local character = localPlayer.Character local movementVector = Vector3.new() local direction = workspace.CurrentCamera.CFrame.LookVector * Vector3.new(1,0,1) if userInputService:IsKeyDown(Enum.KeyCode.LeftShift) then speed = 100 else speed = 25 end if userInputService:IsKeyDown(Enum.KeyCode.W) then movementVector += direction end if userInputService:IsKeyDown(Enum.KeyCode.D) then movementVector += Vector3.new(-direction.Z,0,direction.X) end if userInputService:IsKeyDown(Enum.KeyCode.A) then movementVector += Vector3.new(direction.Z,0,-direction.X) end if userInputService:IsKeyDown(Enum.KeyCode.S) then movementVector += -direction end if userInputService:IsKeyDown(Enum.KeyCode.Q) then movementVector += Vector3.new(0,-20,0) end if userInputService:IsKeyDown(Enum.KeyCode.E) then movementVector += Vector3.new(0,20,0) end if toggle then character.PrimaryPart.Anchored = true if movementVector.Unit.X == movementVector.Unit.X then character.PrimaryPart.CFrame = character.PrimaryPart.CFrame + (movementVector.Unit * speed * delta) end else character.PrimaryPart.Anchored = false end end)