-
What do you want to achieve?
I want fix animation crouch auto play but players isn’t moving, when i moving it stop play crouch animation(Move a bit then stop), when i stand up and crouch back it auto move again -
What is the issue? Include screenshots / videos if possible!
Here is video:
Computer script:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:WaitForChild("Animation"))
local isCrawling = false
local sprint = game.Players.LocalPlayer.PlayerGui.Shift
local mobilesprint = game.Players.LocalPlayer.PlayerGui.Mobile.Run.Sprint
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
if not isCrawling then
mobilesprint.Disabled = true
hum.CameraOffset = Vector3.new(0,-1,0)
sprint.Disabled = true
hum.WalkSpeed = 10
isCrawling = true
anim:Play()
hum.JumpPower = 0
else
mobilesprint.Disabled = false
hum.CameraOffset = Vector3.new(0,0,0)
sprint.Disabled = false
hum.WalkSpeed = 16
anim:Stop()
isCrawling = false
hum.JumpPower = 7.159
end
end
local Event = char.Humanoid.Running:Connect(function(speed)
if speed == 0 then
anim:AdjustSpeed(0)
else
anim:AdjustSpeed(1)
end
end)
end)
Mobile and Ipad script
local UIS = game:GetService("UserInputService").TouchEnabled
local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:WaitForChild("Animation"))
local isCrawling = false
local sprint = game.Players.LocalPlayer.PlayerGui.Shift
local button = game.Players.LocalPlayer.PlayerGui.Mobile.Crouch
local mobilesprint = game.Players.LocalPlayer.PlayerGui.Mobile.Run.Sprint
button.MouseButton1Click:Connect(function()
if not isCrawling then
anim:Play()
char.Humanoid.JumpPower = 0
mobilesprint.Disabled = true
hum.CameraOffset = Vector3.new(0,-1,0)
sprint.Disabled = true
hum.WalkSpeed = 10
isCrawling = true
else
anim:Stop()
char.Humanoid.JumpPower = 7.159
mobilesprint.Disabled = false
hum.CameraOffset = Vector3.new(0,0,0)
sprint.Disabled = false
hum.WalkSpeed = 16
isCrawling = false
end
local Event = char.Humanoid.Running:Connect(function(speed)
if speed == 0 then
anim:AdjustSpeed(0)
else
anim:AdjustSpeed(1)
end
end)
end)
Please if you guys can help, edit a bit about 2 this script for it remove animation crouch auto play when players not moving.