как бегать скрипт
local UserInputService = game:GetService("UserInputService") local character = script.Parent local humanoid = character:FindFirstChildOfClass("Humanoid") local WALK_SPEED = 16 local SPRINT_SPEED = 28 local sprinting = false local function onInputBegan(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.LeftShift then sprinting = true if humanoid then humanoid.WalkSpeed = SPRINT_SPEED end end end local function onInputEnded(input, gameProcessed) if input.KeyCode == Enum.KeyCode.LeftShift then sprinting = false if humanoid then humanoid.WalkSpeed = WALK_SPEED end end end UserInputService.InputBegan:Connect(onInputBegan) UserInputService.InputEnded:Connect(onInputEnded) -- Ensure walkspeed resets if script runs after character spawns if humanoid then humanoid.WalkSpeed = WALK_SPEED end
Название:
как бегать скрипт
Категория:
Разное