|
| 08 Mar 2014 01:25 PM |
--- if game.Workspace.Door.Position == (169.1, 4.9, 178) then script.Parent.BrickColor = BrickColor.new("Really red") elseif game.Workspace.Door.Position => (169.1, 4.9, 178) then script.Parent.BrickColor = BrickColor.new("Lime green") end ---
I'm basically trying to make script.Parent turn Lime Green whenever the object called Door moves up. It doesn't do anything though.
Output: Workspace.Part.Script:1: ')' expected near ',' |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Mar 2014 01:32 PM |
| So is the purpose of this for a door to open and then change colors? |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 08 Mar 2014 01:33 PM |
First line. It needs to be a Vector3 value.
-->if game.Workspace.Door.Position == Vector3.new(169.1,4.9,178) then |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 08 Mar 2014 01:35 PM |
| And 3rd line can't work like that . If its just the height of the doors which varies compare only the Y axis values. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 01:38 PM |
if game.Workspace.Door.Position == Vector3.new (169.1, 4.9, 178) then script.Parent.BrickColor = BrickColor.new("Really red") elseif game.Workspace.Door.Position > (169.1, 4.9, 178) then script.Parent.BrickColor = BrickColor.new("Lime green") end |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 08 Mar 2014 01:41 PM |
| But billy at the third line. You can't compare two vector3 values like that. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 02:25 PM |
So, how would I compare just the y axis values? I'm going to assume using Vector3.y? |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 08 Mar 2014 03:05 PM |
| elseif game.Workspace.Door.Position.Y >= 4.9 then |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 10:13 PM |
My new script is
--- if game.Workspace.Door.Position == Vector3.new (169.1, 4.9, 178) then script.Parent.BrickColor = BrickColor.new("Really red") elseif game.Workspace.Door.Position.Y >= (4.9) then script.Parent.BrickColor = BrickColor.new("Lime green") end ---
It's just stuck on lime green. |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 09 Mar 2014 06:53 AM |
That is because at line one you ask if it has a height equal to 4.9, at line three you ask if it is either EQUAL (again) or bigger than 4.9 So remove the equal sign at the third line. ;) |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2014 09:38 AM |
| okay... it's still stuck lime green. |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 09 Mar 2014 09:56 AM |
Even if you write it like this? --
if game.Workspace.Door.Position.Y == 4.9 then script.Parent.BrickColor = BrickColor.new("Really red") elseif game.Workspace.Door.Position.Y > (4.9) then script.Parent.BrickColor = BrickColor.new("Lime green") end
-- If it is still always lime green, probably your door isn`t really at a height of 4.9 anytime?
|
|
|
| Report Abuse |
|
|
|
| 09 Mar 2014 10:29 AM |
Nope, I checked. Still 4.9.
I tried making the position be greater than 5, and that makes it stuck red. |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
|
| 09 Mar 2014 10:43 AM |
Then your problem is probably with whatever script moves your up or random ``Duh`` mistake elsewhere. That`s all I can say. |
|
|
| Report Abuse |
|
|
Bobogijoe
|
  |
| Joined: 04 Mar 2010 |
| Total Posts: 640 |
|
| |
|