Moving parts for obby

Hey everyone. I was just curious because it’s been in my mind for a while but… does anyone know how to make a part move down when its touched, then after 5 second it comes back up. I would use this for an obby. For example… When someone steps on the part it sinks down into the ground. Some of you might say that you can just make it unanchored. I want an animation for it. If anyone knows how to do this please feel free to leave a comment thanks!

1 Like

use part.CFrame:Lerp() if you want to have somewhat of a animation to moving the part.

You could use the TweenService to animate the Part when it’s touched.

Example:

local TweenService = game:GetService("TweenService")
local part = workspace.Part -- or wherever your part is located

--create tween here

part.Touched:Connect(function(hit)

    -- play the tween using :Play() after your variable for the created tween

end)

I don’t know what I did wrong so here are some pictures. If you can help me out that would be great.

1 Like

“part” is set to “game.Workspace”, meaning you are trying to tween the entire Workspace. Also its Position with a capital P.

2 Likes

ohhhhhhh ok thank you.
So I set the part by doing

local part = script.Parent? I’m pretty new so I’m just making sure.

Nvm I got it, thank you! Have a good day.