|
| 31 Oct 2013 11:47 PM |
I'm having a problem here. Making a CFrame door and when you touch a button it slides open then will close. My problem Is when It's on a Z Axis the door will open and rotate to the X axis. The doors that have the problem are the ones on the Z Axis of the building. The ones on the X Axis open fine with no problem and no rotating. These door rise up on the Y Axis then close back down.
Here is the script. It's the same one on all for doors. The two on the X work, and the two on the Z when they go to open they rotate to X and continue there way up then back down.
---------------------------------------- Bin = script.Parent Door1 = Bin.Door1 Enabled = true function Touch(hit) if Enabled == true then Enabled = false for e = 1,31 do Door1.CFrame = CFrame.new(Door1.CFrame.x,Door1.CFrame.y + 0.6,Door1.CFrame.z) wait(0.01) end wait(2) for r = 1,31 do Door1.CFrame = CFrame.new(Door1.CFrame.x,Door1.CFrame.y - 0.6,Door1.CFrame.z) wait(0.01) end Enabled = true end end Bin.Button1.Touched:connect(Touch) Bin.Button2.Touched:connect(Touch) ----------------------------------------
Any help would be much appreciated. Still trying to learn, and understand this stuff.
Thanks! Turbo.
|
|
|
| Report Abuse |
|
|
Asleum
|
  |
| Joined: 07 Nov 2008 |
| Total Posts: 185 |
|
|
| 01 Nov 2013 01:35 AM |
The problem comes from the fact that each time you apply a new CFrame using CFrame.new() to a brick, it's rotation will be reseted. Here is how to translate a brick without changing it's rotation : Brick.CFrame = Brick.CFrame + Vector3.new(1, 2, 3)
So you'll need to change this line : Door1.CFrame = CFrame.new(Door1.CFrame.x,Door1.CFrame.y + 0.6,Door1.CFrame.z) To this : Door1.CFrame = Door1.CFrame + Vector3.new(0, .6, 0) |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2013 01:00 PM |
Alright bud! Thanks! I'll go give that a try now and see what happens.
Cheers! |
|
|
| Report Abuse |
|
|
|
| 01 Nov 2013 01:09 PM |
Thanks again buddy! Got it working! :D
Cheers mate! Turbo |
|
|
| Report Abuse |
|
|