How would I go about making a victory animation?

I want to make it so that when the player touches a brick, they do a victory animation. While the animation is playing, the player cannot jump or move. This will also make the character float in the air if they touch the animation brick while in the air. I tried searching for the script I needed via free models and tutorials before actually making the script myself, and I found what I needed!

The problem is that I only have the animation part. I don’t know how to make the player stay still while the animation is playing. I first thought of setting the players walkspeed and jump height to 0, but it didn’t work. The walkspeed/jump height solution didn’t work not because I made an error in the script, but because my game has a momentum script. When the player is standing still, this script will reset the players walk speed (which makes the player able to run around at normal speed even after touching the brick). I then tried anchoring the player when they touch the brick, but the animation doesn’t run smoothly. Plus, at random times when touching the brick, the player won’t be Up-right, making the whole animation look weird.

Here’s the script

local Anim = script.Parent.Animation -- Animation
	local debounce = false
	 
	script.Parent.Touched:connect(function(hit)
	    if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
		debounce = true
	        local AnimTrack = hit.Parent.Humanoid:LoadAnimation(Anim)
	        AnimTrack:Play()
	        wait(2) -- Seconds Before You Can Play Animation Again.
	        debounce = false
	    end
	end)

Anyways, I made you a game for this!

bad game by me.rbxl (30.0 KB)
enjoy <3

1 Like

this actually works very well! Thanks for making this!