local ReplicatedStorage = game:GetService("ReplicatedStorage")
local runEvent = ReplicatedStorage:WaitForChild("RunAnimationEvent")
local runAnimationId = "rbxassetid://91701202879948"
local function playRunAnimation(player, play)
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
if not humanoid:FindFirstChild("RunTrack") then
local runAnimation= Instance.new("Animation")
runAnimation.AnimationId = runAnimationId
local track = humanoid:LoadAnimation(runAnimation)
track.Name = "RunTrack"
end
local track = humanoid:FindFirstChild("RunTrack")
if play then
if not track.IsPlaying then
track:Play()
end
else
if track.IsPlaying then
track:Stop()
end
end
end
runEvent.OnServerEvent:Connect(playRunAnimation)