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

Auto Updating on Touch?

Asked by 9 years ago

let me explain. This is based on my RPG enemy animation script; so basically there is a part where the enemy spawns and when the enemy leaves it plays his animation, but when he comes back it stops the animation. so how can I make it turn on and off when the part is touched, and how do I know when the enemy has left/not touching the block? Basic Idea:

function onTouched()
    script.Parent.Animate.Touching = false -- so this turns the variable off, so the script knows to stop animating
end
script.Parent.ESpawn.Touched:connect(onTouched)-- so when he touches the part it stops the animation. But what about when he leaves the block? How do we tell so we can turn the variable back to true - BUT also make this script auto update(while loop)?

Ik there are easier ways to do this. But im experimenting. Thanks for the help ~bubs

Answer this question