RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a script that makes you first person and make's you walk in a realistic way"
-- local script local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local humanoid = player.Character.Humanoid camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = CFrame.new(humanoid.RootPart.Position) local walkSpeed = 8 local jumpPower = 50 local isJumping = false humanoid.WalkSpeed = walkSpeed humanoid.JumpPower = jumpPower local function animate() local moveVector = Vector3.new() local moveDirection = camera.CFrame.lookVector if InputService:IsKeyDown(Enum.KeyCode.W) then moveVector = moveVector + moveDirection end if InputService:IsKeyDown(Enum.KeyCode.A) then moveVector = moveVector - camera.CFrame.rightVector end if InputService:IsKeyDown(Enum.KeyCode.S) then moveVector = moveVector - moveDirection end if InputService:IsKeyDown(Enum.KeyCode.D) then moveVector = moveVector + camera.CFrame.rightVector end if moveVector.magnitude > 0 then humanoid:Move(moveVector * walkSpeed) end if InputService:IsKeyDown(Enum.KeyCode.Space) and not isJumping then isJumping = true humanoid:ChangeState(Enum.HumanoidStateType.Jumping) wait(0.1) humanoid.Jump = true wait(0.5) isJumping = false end end game:GetService("RunService").RenderStepped:Connect(animate)