Talk:How to Make a Part Slide with CFrame

From Legacy Roblox Wiki
Jump to navigationJump to search

This is not what the wiki is for. And even if we are going to have a page like this, instead of just giving a free script to newbies and saying what everything does, why not actually explain how to do stuff? I can work on a complete re-write of this if it's okay, but this page really doesn't help the wiki's reputation, nor does it help teach anyone. --crazypotato4 20:12, 24 July 2011 (UTC)

Yeah go ahead. Me and Tom wrote most of this, Tom created it, I edited it a little to make it less 'just-take-the-code-and-go', and then, I think it was MrNicNac that generalised it from just making a door to making a part slide.
Trappingnoobs (Writer) Have I done something bad? Good? Tell me on my talk page 21:19, 24 July 2011 (UTC)

Completely changing the page

The new code is worse than the old code. The problems are:

Naming a variable debounce
Never do this. Seriously. It just makes debounce become "magic". Name is something descriptive, like "moving"
PascalCase local variables
While I don't think there's an official style, I think local variables should be lowerCamelCase.
You're moving things relatively
If the door gets knocked out of place, then it won't move back
Creating a direction vector using CFrame.new(Part.Position, newPos).lookVector</syntaxhighlight>
Seriously, what? (newPos - Part.Position).unit</syntaxhighlight>. All your vector code looks dubious. It'll work, but it's the wrong approach.
22:19, 24 July 2011 (UTC)