generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: CFrame question.

Previous Thread :: Next Thread 
TurboNightmare is not online. TurboNightmare
Joined: 12 Feb 2013
Total Posts: 96
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 is not online. 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
TurboNightmare is not online. TurboNightmare
Joined: 12 Feb 2013
Total Posts: 96
01 Nov 2013 01:00 PM
Alright bud! Thanks! I'll go give that a try now and see what happens.

Cheers!
Report Abuse
TurboNightmare is not online. TurboNightmare
Joined: 12 Feb 2013
Total Posts: 96
01 Nov 2013 01:09 PM
Thanks again buddy! Got it working! :D

Cheers mate!
Turbo
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image