Play animation when touching a part


So i’m trying to make a teleportation script were if you step on a teleporting part it uses a animation on the player to make it look more realistic now i’m not sure how to code this one ive already made it so it makes a sound Ontouch and that it teleports you towards the other location but now I just need to be able to make it play a new Animation inside of the player so it looks more realistic


I hope I understood what you were trying to do. Here’s some code I wrote.

  • Explorer Tab

Explorer Tab

  • Code
local part = script.Parent

local part2 = script.Parent.Parent.Part2

local id = script.Parent.Parent.AnimID


	local char = hit.Parent
	local hum = char:WaitForChild("Humanoid")
	local Hrp = char:FindFirstChild("HumanoidRootPart")
	local animation ="Animation")
	animation.AnimationId = id
	local animtrack = hum:LoadAnimation(animation)
	wait(15)  -- Just to see the animation
	if Hrp then
		Hrp.Position = part2.Position 

1 Like

Yeah that helped, Huge thanks!

1 Like