How would I make this script run once

So I want a npc to wave like the /e wave I have the id and the script to make the npc wave but the thing is idk how to make the script run 1 time so like it waves 1 time and it is in a loop which I can’t break I have tryed things like:
wait(2)
script.Disabled = true

but here is the code to make the animation run:

local controller = script.Parent.Humanoid
controller:LoadAnimation(script.Animation):Play()

there is a animation thingy inside the script and the id: http://www.roblox.com/asset/?id=507770239
so umm I would really like help

Maybe add a wait() after, and then disable the script after so many seconds.

You need to stop the animation directly because the animation is on a loop not the script. You can you the AnimationTrack:Stop() referenced here

not working tryed using what was written on there tryed your animationtrack stop thing

You need to use the :stop() command on the defined animation. You should try:
`
local Animation = controller:LoadAnimation(script.Animation) --Define the animation for reference

Animation:Play()
wait(2)
Animation:Stop()
`

1 Like