local Player = game.Players.LocalPlayer local Character =…
- User
local Player = game.Players.LocalPlayer local Character = workspace:WaitForChild(Player.Name) local Humanoid = Character:WaitForChild('Humanoid')
local RunAnimation = Instance.new('Animation') RunAnimation.AnimationId = 'rbxassetid://13721411858' RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
function Handler(BindName, InputState) if script.Parent.Crouch.Crouching.Value == false then if InputState == Enum.UserInputState.Begin and BindName == 'RunBind' then Running = true Humanoid.WalkSpeed = 20 elseif InputState == Enum.UserInputState.End and BindName == 'RunBind' then Running = false if RAnimation.IsPlaying then RAnimation:Stop() end Humanoid.WalkSpeed = 14 end end end
Humanoid.Running:connect(function(Speed) if Speed >= 10 and Running and not RAnimation.IsPlaying then RAnimation:Play() Humanoid.WalkSpeed = 20 elseif Speed >= 10 and not Running and RAnimation.IsPlaying then RAnimation:Stop() Humanoid.WalkSpeed = 14 elseif Speed < 10 and RAnimation.IsPlaying then RAnimation:Stop() Humanoid.WalkSpeed = 14 end end)
Humanoid.Changed:connect(function() if Humanoid.Jump and RAnimation.IsPlaying then RAnimation:Stop() end end)
game:GetService('ContextActionService'):BindAction('RunBind', Handler, true, Enum.KeyCode.LeftShift) сделай так чтобы когда игрок пятится назад (то есть идет спиной вперед) его скорость уменьшалась. так же соблюдай правила скрипты. если скорость игрока <= 10, то это значит что он ползет, а если он ползет, то нельзя бегать, соответственно он не может бежать.
- Assistant
local Player = game.Players.LocalPlayer local Character = workspace:WaitForChild(Player.Name) local Humanoid = Character:WaitForChild('Humanoid')
local RunAnimation = Instance.new('Animation') RunAnimation.AnimationId = 'rbxassetid://13721411858' RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
function Handler(BindName, InputState) if script.Parent.Crouch.Crouching.Value == false then if InputState == Enum.UserInputState.Begin and BindName == 'RunBind' then Running = true Humanoid.WalkSpeed = 20 elseif InputState == Enum.UserInputState.End and BindName == 'RunBind' then Running = false if RAnimation.IsPlaying then RAnimation:Stop() end Humanoid.WalkSpeed = 14 end end end
local function UpdateAnimation() if Humanoid.WalkDirection == Enum.WalkDirection.Backward then Humanoid.WalkSpeed = 10 elseif Running and not RAnimation.IsPlaying then RAnimation:Play() Humanoid.WalkSpeed = 20 elseif not Running and RAnimation.IsPlaying then RAnimation:Stop() Humanoid.WalkSpeed = 14 end end