|
| 02 Mar 2015 04:22 PM |
I'm trying to make a door where when you click it it moves then after a couple seconds moves back
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.Door1.Part2.Position = Vector3.new(13, 4.997, 17.5) game.Workspace.Door1.Part1.Position = Vector3.new(12, 5.197, 16.5) game.Workspace.Door1.Part2.Rotation = Vector3.new(0,0,0) game.Workspace,Door1.Part1.Rotation = Vector3.new(0,0,0)
end)
That works and it moves to where its suppsoed to so then I decied to add this afterwards
Wait(5)
if game.Workspace.Door1.Part2.Position == (13, 4.997, 17.5) then game.Workspace.Door1.Part2.Position = Vector3.new(15.5, 4.999, 20.2) end
if game.Workspace.Door1.Part1.Position == (12, 5.197, 16.5) then game.Workspace.Door1.Part2.Position = Vector3.new(14.5, 5.199, 21.2) end
but then I get this error " Workspace.Door1.Script:11: 'then' expected near ','"
Im not sure what to do but??? |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 04:23 PM |
| Add Vector3.new before each of your (x, y, z) things in your if statements. |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Mar 2015 04:39 PM |
| What's the current error with those changes? Repost your script too. |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 04:44 PM |
Theres no error now it just doesn't work
it'll move the part but won't move back
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.Door1.Part2.Position = Vector3.new(13, 4.997, 17.5) game.Workspace.Door1.Part1.Position = Vector3.new(12, 5.197, 16.5) game.Workspace.Door1.Part2.Rotation = Vector3.new(0,0,0) game.Workspace.Door1.Part1.Rotation = Vector3.new(0,0,0)
end)
wait(5)
if game.Workspace.Door1.Part2.Position == Vector3.new(13, 4.997, 17.5) then game.Workspace.Door1.Part2.Position = Vector3.new(15.5, 4.999, 20.2) end
if game.Workspace.Door1.Part1.Position == Vector3.new(12, 5.197, 16.5) then game.Workspace.Door1.Part2.Position = Vector3.new(14.5, 5.199, 21.2) end |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 04:46 PM |
Your wait and other statements are outside of the function triggered by MouseClick. This is fixed by moving "end)"
script.Parent.ClickDetector.MouseClick:connect(function(player) game.Workspace.Door1.Part2.Position = Vector3.new(13, 4.997, 17.5) game.Workspace.Door1.Part1.Position = Vector3.new(12, 5.197, 16.5) game.Workspace.Door1.Part2.Rotation = Vector3.new(0,0,0) game.Workspace.Door1.Part1.Rotation = Vector3.new(0,0,0)
wait(5)
if game.Workspace.Door1.Part2.Position == Vector3.new(13, 4.997, 17.5) then game.Workspace.Door1.Part2.Position = Vector3.new(15.5, 4.999, 20.2) end if game.Workspace.Door1.Part1.Position == Vector3.new(12, 5.197, 16.5) then game.Workspace.Door1.Part2.Position = Vector3.new(14.5, 5.199, 21.2) end end) |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 04:50 PM |
| ohhhhhhhhhh thanks lol it works now |
|
|
| Report Abuse |
|
|