Well, I have a problem and it is that the action animation plays many months and I have to stop it with the same script, but it is frustrating to have to check the waiting time to stop it
local PlayAnim = script.Parent:WaitForChild("PlayAnim")
local Value = script.Parent:WaitForChild("Acción")
local Debounce2 = false
local tool = script.Parent
local function mine()
if not Debounce2 then
local Character = script.Parent.Parent
local AnimationTrack = Character:WaitForChild("Humanoid"):LoadAnimation(PlayAnim)
Debounce2 = true
AnimationTrack:Play()
wait(0.33)
Value.Value = true
AnimationTrack:Stop()
wait(0.2)
Value.Value = false
wait(0.1)
Debounce2 = false
end
end
tool.Activated:Connect(mine)
Unfortunately the .Looped property doesn’t replicate from the server to the client for some reason. So you have to play the animation through the clients using a RemoteEvent, changing the .Looped property and playing the animation in a LocalScript