|
| 12 Jun 2014 09:49 PM |
I am developing a script that opens a door with CFrame value and closes it every five seconds. However I can't seem to find the solution to this conflict.
Error; Workspace.Door.Script:88: ')' expected (to close '(' at line 3) near 'end'
*Keep in mind I am still a noob at scripting and that this script is an experiment upon my knowledge of Lua.
The script;
Door = script.Parent
Door.Touched:connect(function() print("Door opening") Door.CFrame = CFrame.new(Vector3.new(-10.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.0, 2.39, -6)) print("Door opened") wait(5) print("Door closing") Door.CFrame = CFrame.new(Vector3.new(-7.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-7.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-8.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-9.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.0, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.2, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.4, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.6, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-10.8, 2.39, -6)) wait(.1) Door.CFrame = CFrame.new(Vector3.new(-11.0, 2.39, -6)) print("Door closed") end end) |
|
|
| Report Abuse |
|
|
| 12 Jun 2014 09:53 PM |
Door.CFrame = Vector3.new(-10.8, 2.39, -6)
I'm pretty sure you don't need to put a CFrame.new AND THEN a vector3.new
Also, instead of Cframe I recommend your script changes Position and Rotation, "Cframe" is NOT part of a Part's Data. |
|
|
| Report Abuse |
|
|
| 12 Jun 2014 09:53 PM |
First of all, loops. Use them.
Secondly, get rid of the end that doesn't have the ) after it, it's not needed
-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::] |
|
|
| Report Abuse |
|
|
| 12 Jun 2014 09:54 PM |
Well uh, first off, for loop pls, second, CFrame.new(number,number,number), not CFrame.new(Vector3.new(x,y,z)
That's unnecessary
You probably forgot a ')', or have one where it shouldn't be |
|
|
| Report Abuse |
|
|
| 12 Jun 2014 09:55 PM |
If you want to Loop, use while true do, throw in another end, and put a wait() before the end.
Good to know if you want to loop.
|
|
|
| Report Abuse |
|
Foxconn
|
  |
| Joined: 20 Feb 2011 |
| Total Posts: 275 |
|
|
| 12 Jun 2014 10:47 PM |
| Also, I don't think you need two 'end' closers. Since I don't see any other functions other than the trigger at the top. |
|
|
| Report Abuse |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Jun 2014 10:50 PM |
He can keep the Vector3's in there. It's one of the many constructors CFrame has.
CF.new(x, y, z) and CF.new(v3) work the same way. |
|
|
| Report Abuse |
|