|
| 01 Aug 2016 09:59 AM |
Im creating a cooldown on a knife animation, how do I do the Stopped event on the AnimationTrack? How do I even define it? Im confused, because the API:Class says it cannot be created.
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 01 Aug 2016 12:44 PM |
I don't quit understand the question. this is usually how I load animations.
local Animation = "LocationHere" local Humanoid = "LocationHere" local AnimTrack = Humanoid:LoadAnimation(AnimTrack)
And then you can use, AnimTrack:Play() and AnimTrack:Stop()
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2016 12:49 PM |
Alright, i need the event Stopped to fire. But im not sure how to write it. This doesnt work: local insterpath = workspace.Path.ToAnimation local animation = player.Character.Humanoid:LoadAnimation(instertpath)
animation.Stopped:connect(function(bob) --code end)
error: animation is a nil value.
But that cant be it, because the animation plays! And if I go:
insertpath.Stopped:connect(function(bob) --code end)
Then it says Stopped isnt a member of Animation. ????
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 01 Aug 2016 12:52 PM |
Uhh, maybe if the Animation is not looped you can do a cooldown by doing this:
wait(AnimationLength) CoolDownFinished = true
I forgot if AnimationLength is an actually property. I'm not sure.
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2016 12:55 PM |
Well the animation starts by an OnClick function, so basically I would have to start the timer by when you click. Problem is, if you spam click, it offsets the wait time. Making it spammable. (Ive tried RIP) And yes, this Stopped Event exists.
http://wiki.roblox.com/index.php?title=API:Class/AnimationTrack/Stopped
|
|
|
| Report Abuse |
|
|
| |
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 01 Aug 2016 06:30 PM |
Uhh try this
local CoolDown = false --Make sure to define AnimTrack and all that stuff again
local function WhenActivated() --Whenever you press tool if CoolDown == false then CoolDown = true wait(AnimTrack.Length) CoolDown = false end end
|
|
|
| Report Abuse |
|
|