So I have this script here that makes the dummy play the animation when a part is touched.

local function onTouch(hit)
	local animationId = 3248288444
	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
		local animation = Instance.new("Animation")
		animation.AnimationId = "https://www.roblox.com/Asset?ID="..animationId
		print("AnimationLoaded")
		local PlayAnimation = game.Workspace.ScareActor.Humanoid:LoadAnimation(animation)
		PlayAnimation:Play()
		print("PlayingAnimation")
	end
end

script.Parent.Touched:Connect(onTouch)

the only thing is the animation starts over from the begining before it is finshed. So for example, if the animation is 3 seconds long, it would play 1 second, then start over before playing the 3 seconds of it. I know it sounds complicated but I need help if you understand. Thank you.

PS. I tried wait() afterPlayAnimation:Play() and it didn't work.

3 comments

0

Try adding a debounce to the touched part https://developer.roblox.com/en-us/articles/Debounce

0

It worked, thanks!

0

Your welcome, if you could mark my answer as accepted that would be appreciated.