i need after the animation add the heartbeat will end, how to make it
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remotes = ReplicatedStorage:WaitForChild("Remotes")
local RunRemote = ReplicatedStorage.Remotes:WaitForChild("RunRemote")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local Animations = ReplicatedFirst:WaitForChild("Animations")
local otherAnims = Animations:WaitForChild("Other")
local RunAnim = otherAnims.Run
local rs = game:GetService("RunService")
local function playRunAnimation(char)
if not PlayAnim and char.HumanoidRootPart.Velocity.Magnitude > 0.01 then
PlayAnim = char.Humanoid:LoadAnimation(RunAnim)
PlayAnim:Play()
end
end
local function stopRunAnimation()
if PlayAnim then
PlayAnim:Stop()
PlayAnim = nil
end
end
RunRemote.OnServerEvent:Connect(function(player,run)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local attacking = char:GetAttribute("Attacking")
local blocking = char:GetAttribute("Blocking")
local stunned = char:GetAttribute("Stunned")
local ragdolled = char:GetAttribute("Ragdolled")
local frozen = char:GetAttribute("Frozen")
local running = char:GetAttribute("Running")
if run then
if blocking or attacking or stunned or ragdolled or frozen then return end
char:SetAttribute("Running",true)
hum.WalkSpeed = 25
rs.Heartbeat:Connect(function(r)
playRunAnimation(char)
end)
else
if running then
char:SetAttribute("Running",false)
hum.WalkSpeed = 16
stopRunAnimation()
end
end
end)