Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I add a cooldown to this Animation?

Asked by 6 years ago

The Local Script:

script.Parent.Activated:Connect(function()
    script.Parent.RemoteEvent:FireServer()

end)

The Server Script:

script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player)

        local Animation = script.Parent.Animation
        local animationTrack = Player.Character.Humanoid:LoadAnimation(Animation)
        animationTrack:Play()

        local Tool = script.Parent
        Tool.GripForward = Vector3.new(0.989, -0.151, -0.009)
        Tool.GripPos = Vector3.new(-0.566, -1.024, 0.181)
        Tool.GripRight = Vector3.new(0.151, 0.987, 0.059)
        Tool.GripUp = Vector3.new(0, 0.06, -0.998)
        wait(1.2)

        animationTrack.Stopped:Connect(function()
            Tool.GripForward = Vector3.new(0.989, 0, -0.151)
            Tool.GripPos = Vector3.new(-0.566, -0.588, 0)
            Tool.GripRight = Vector3.new(0.151, 0, 0.989)
            Tool.GripUp = Vector3.new(0, 1, 0)

    end)
end)

I wanted it to have a 2-second cooldown but I have tried debounce and other ways from YouTube and I am lost how to add a cooldown to this. Thanks for the help.

0
animations should be loaded from the client GoldAngelInDisguise 297 — 6y
0
Not exactly, Animations can be loaded from both. You could have a funny game where you make everyone do an animation dance if somebody clicks a TextButton. So yeah, you can load it both ways, but Client is more common. TheOnlySmarts 233 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

adding a wait after firing the remote

0
This should be a comment, if you're answering a question, add more detail. Only answer questions for more complex scripts, like I said. What you said could be said easily with a quick post of a comment. But you're new so I don't care xD. Just be more aware. TheOnlySmarts 233 — 6y
0
im sorry ;( CardJester 15 — 5y
Ad
Log in to vote
0
Answered by
hoth7 45
6 years ago

do wait(your time to want to wait till the script under is activated)

Answer this question