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: Oven Door Script

Previous Thread :: Next Thread 
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 10:14 AM
This is a script I made for an oven, and I got it done, but it's not working. :/ The 'door' is the oven door. Onclick, it will open. But if already open and clicked, it will close.

door = script.Parent

function onClicked()
if door.Rotation = -0,0,0 then
door.Rotation = 90,0,0
end
if door.Rotation = 90,0,0 then
door.Rotation = 0,0,0
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
orangegreenblue is not online. orangegreenblue
Joined: 04 Sep 2010
Total Posts: 10906
22 May 2014 10:17 AM
Rotation is a Vector3 value.

door.Rotation = 90,0,0

should be

door.Rotation = Vector3.new(90, 0, 0)

for example
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 10:18 AM
Oops, I meant this script. (I had an error in the other)
door = script.Parent

function onClicked()
if door.Rotation = -0,0,0 then
door.Rotation = 90,0,0
else
door.Rotation = -0,0,0
end
if door.Rotation = 90,0,0 then
door.Rotation = -0,0,0
else
door.Rotation = 90,0,0
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
masterCameron101 is not online. masterCameron101
Joined: 28 Mar 2010
Total Posts: 1377
22 May 2014 10:39 AM
script.Parent.ClickDetector.MouseClick:connect(function()
if door.Rotation.X==0 then
door.Rotation=Vector3.new(90,0,0)
elseif door.Rotation.X==90 then
door.Rotation=Vector3.new(0,0,0)
end)
--didn't test this. (Made it in my browser.)

~masterCameron101, advanced Lua programmer, certified in Photoshop. Have I helped you? Don8~
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 10:58 AM
Doesn't work, and I'm trying everything to fix!
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
22 May 2014 11:02 AM
clickDetector.MouseClick:connect(function()
if door.Rotation = Vector3.new(0,0,0) then
door.Rotation = Vector3.new(90,0,0)
else
door.Rotation = Vector3.new(0,0,0)
end
end)

Define clickDetector
Define door
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
22 May 2014 11:03 AM
clickDetector.MouseClick:connect(function()
door.Rotation = Vector3.new(door.Rotation.X > 0 and 0 or 90,0,0)
end)

^ maybe
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 11:07 AM
So, here is what I have..
door = script.Parent.Parent
clickDectector = script.Parent


clickDetector.MouseClick:connect(function()
if door.Rotation = Vector3.new(0,0,0) then
door.Rotation = Vector3.new(90,0,0)
else
door.Rotation = Vector3.new(0,0,0)
end
end)

And this is the error it says in the script..

Line 6..
'then' expected near '='
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
22 May 2014 11:08 AM
did I seriously forget a =?!

DEFINE THE THINGS.

clickDetector.MouseClick:connect(function()
if door.Rotation == Vector3.new(0,0,0) then
door.Rotation = Vector3.new(90,0,0)
else
door.Rotation = Vector3.new(0,0,0)
end
end)
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 11:17 AM
THE SCRIPT WORKS! :D Now all I have to do is find the correct positioning, I guess I got the numbers wrong... the oven door is going through the burners. o-o LOL
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 11:19 AM
How would I make it so it also sets it to this position? x3

2.48, 2.99, 31.3

Sorry for the trouble... o-o I just never worked with positioning and Vector3 values and stuff.
Report Abuse
Alpal425 is not online. Alpal425
Joined: 29 Mar 2011
Total Posts: 214
22 May 2014 11:23 AM
Pose 1
Rotation 90,0,0
Position 2.48, 2.79, 31.3

Pose 2
Position 2.48, 4.19, 30.1
Rotation 0,0,0
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
22 May 2014 12:35 PM
This probably won't work but you need t use CFrame.Angles not rotation maybe some one can fix this if it doesn't work.


local function MoveModel(Model,NewCFrame)
local Center=Model.Center
Center.CFrame=NewCFrame
door = script.Parent

function onClicked()
for i = 1,10 do
MoveModel(door,door.Center.CFrame*CFrame.Angles(0,0,0.49))
wait(0.070)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
end
end

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