local event = game.ReplicatedStorage.crouch
function playanimation(char:Model, anim:Animation, loop, speed)
local humaniod = char:FindFirstChildOfClass("Humanoid")
local track = humaniod:FindFirstChildOfClass("Animator"):LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = loop
track:Play()
track.Stopped:Wait()
end
game.Players.PlayerAdded:Connect(function(plr)
plr:SetAttribute("crouching", false)
plr.CharacterAdded:Connect(function(char)
end)
end)
function crouch(player:Player, bool)
if bool then
playanimation(player.Character, game.ReplicatedStorage.animationtracks.crouch, false, 1)
playanimation(player.Character, game.ReplicatedStorage.animationtracks.idle, true, 1)
else
end
end
event.OnServerEvent:Connect(function(plr, data:any)
crouch(plr, data)
end)
idk how to handle walking and uncrouching