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: How would i do this???

Previous Thread :: Next Thread 
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
YourNeverSafe is not online. YourNeverSafe
Joined: 30 Dec 2011
Total Posts: 462
31 Dec 2011 11:07 AM
Use values,
or parent it to the camera.
Report Abuse
Z3R0xT0L3R4NC3 is not online. Z3R0xT0L3R4NC3
Joined: 06 Feb 2011
Total Posts: 127
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
31 Dec 2011 11:10 AM
ok, thanks for the help
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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 is not online. 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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
31 Dec 2011 11:39 AM
ok, thanks for clearing that up
Report Abuse
1pie23 is not online. 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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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 is not online. 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 is not online. 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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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 is not online. 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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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 is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
31 Dec 2011 11:58 AM
Try if string.lower(o..)
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
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