|
| 31 Dec 2011 10:41 AM |
How would i make it so that there is an owner to this brick that has this script in it(kind of like in a tycoon, where only 1 person can do it) Please help me!
script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end) |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:07 AM |
Use values, or parent it to the camera. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:08 AM |
You could either put a value into the brick that becomes the person's name or(less used method) make the brick name the player's name. Then you just put an argument into the script, say o, and do an if then statement
if string.lower(o) == string.lower(script.Parent.Name or script.Parent.OwnerName.Value) then |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Dec 2011 11:13 AM |
if string.lower(o) == string.lower(script.Parent.Name or script.Parent.OwnerName.Value) then where did the o come from? |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:26 AM |
I put it in my script but it still does not work. I also have a stringValue in the part that the scripts in, but it does not work, no errors show up or anything.
Script:
if string.lower(o) == string.lower(script.Parent.OwnerName.Value) then script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end)
|
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 31 Dec 2011 11:38 AM |
If you read his post, o would be the argument. So your script should look like this:
script.Parent.ClickDetector.MouseClick:connect(function(o) if string.lower(o) == string.lower(script.Parent.OwnerName.Value) then if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end end)
Idk if the ends line up, I was never good at that... |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:39 AM |
| ok, thanks for clearing that up |
|
|
| Report Abuse |
|
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 31 Dec 2011 11:41 AM |
| The string.Lower(o) is wrong. o is a string, therefor do this: ("o") |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:42 AM |
I used this script but i got an error
script.Parent.ClickDetector.MouseClick:connect(function(o) if string.lower(o) == string.lower(script.Parent.OwnerName.Value) then if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end) end)
Error:
Workspace.Part.Paint Script:12: '< eof> ' expected near 'end' |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 31 Dec 2011 11:43 AM |
| Yea, I screwed up the ends... Take away an end and see if it works |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 31 Dec 2011 11:44 AM |
| Pie. O is an argument and not a string. It represents whoever clicked the button |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:47 AM |
I tried again, but i got a new error...
Workspace.Part.Paint Script:2: bad argument #1 to 'lower' (string expected, got userdata) Script "Workspace.Part.Paint Script", Line 2 stack end Disconnected event because of exception |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 31 Dec 2011 11:49 AM |
| Hm... Then maybe Pie was right... Unless you'd have to put o.. |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:54 AM |
I did what pie said to but i got another error...
Script
script.Parent.ClickDetector.MouseClick:connect(function("o") if string.lower("o") == string.lower(script.Parent.OwnerName.Value) then if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end)
Error:
Workspace.Part.Paint Script:1: < name > or '...' expected near '"o"' |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2011 11:55 AM |
I tried removing the o but i got this error
Script:
script.Parent.ClickDetector.MouseClick:connect(function("o") if string.lower("o") == string.lower(script.Parent.OwnerName.Value) then if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end)
Errors:
Workspace.Part.Paint Script:1: < name > or '...' expected near '"o"' |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
| |
|
|
| 31 Dec 2011 12:01 PM |
I did this...
script.Parent.ClickDetector.MouseClick:connect(function(o) if string.lower(o..) == string.lower(script.Parent.OwnerName.Value) then if script.Parent.BrickColor == BrickColor.new("Institutional white") then script.Parent.BrickColor = BrickColor.new("Really black") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") elseif script.Parent.BrickColor == BrickColor.new("Really black") then script.Parent.BrickColor = BrickColor.new("Institutional white") end end end)
but i got this error....
Workspace.Part.Paint Script:2: unexpected symbol near ')' |
|
|
| Report Abuse |
|
|