#i need help with my movement script how can i fix it

1 messages · Page 1 of 1 (latest)

mental iron
#

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

local walkSpeed = 16
local sprintSpeed = 24
local crouchSpeed = 8
local isSprinting = false
local isCrouching = false

local function updateSpeed()
if isSprinting and not isCrouching then
humanoid.WalkSpeed = sprintSpeed
elseif isCrouching then
humanoid.WalkSpeed = crouchSpeed
else
humanoid.WalkSpeed = walkSpeed
end
end

-- Bind input for PC + Xbox
local function bindInputs()
UserInputService.InputBegan:Connect(function(input, gameProcessed)
-- NO MORE "if gameProcessed then return end"