Sergey Shiyanov
Знаток
(293)
1 месяц назад
local button = "C"
local speed = 10
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
repeat wait() until player.Character
local chr = player.Character
local human = chr:WaitForChild("Humanoid")
local DFSpeed = human.WalkSpeed
local isdown = false
local idle = script:WaitForChild("Animation"):WaitForChild("idle")
local walk = script:WaitForChild("Animation"):WaitForChild("sneak")
local playidle = human:LoadAnimation(idle)
local playsneak = human:LoadAnimation(walk)
playidle.Priority = Enum.AnimationPriority.Action
playsneak.Priority = Enum.AnimationPriority.Movement
local function updateAnimations()
if isdown then
if human.MoveDirection.Magnitude > 0 then
playsneak:Play()
else
playsneak:Stop()
playidle:Play()
end
else
playidle:Play()
end
end
uis.InputBegan:Connect(function(p, c)
if not c then
if p.KeyCode == Enum.KeyCode[button] then
if not isdown then
isdown = true
human.WalkSpeed = speed
updateAnimations()
end
end
end
end)
uis.InputEnded:Connect(function(p, c)
if not c then
if p.KeyCode == Enum.KeyCode[button] then
isdown = false
human.WalkSpeed = DFSpeed
updateAnimations()
end
end
end)