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

I need help on a CFrame Sliding script?

Asked by 10 years ago

What would I learn to have a door slide up when it is touched. ** **I know the Touched event, just dont know what CFrame

1 answer

Log in to vote
3
Answered by
2eggnog 981 Moderation Voter
10 years ago

To CFrame something upward, you can do this:

door.CFrame = door.CFrame*CFrame.new(0,1,0)

That will move a part up one stud. Making the one into a negative one will make it move downward. If you want to give the effect of a door sliding upward, this code will slide it upward twenty studs.

for i=1,200 do
door.CFrame = door.CFrame*CFrame.new(0,.1,0)
wait()
end

Again, making the number in the CFrame negative will make it slide downward.

Now you can use that to make a sliding gate. Just remember to add debounce while the door is sliding.

Ad

Answer this question