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: What's wrong with this script?

Previous Thread :: Next Thread 
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:00 PM
I keep getting an error saying that there is an unexpected symbol in line 3 near "."

Here it is;

part = game.Workspace.Part

local part.Touched:connect(function()
Workspace.Part.BrickColor = BrickColor.new('Teal')
if Workspace.Part.BrickColor = ('Teal')
then Workspace.Part.Touched:connect(function()
Workspace.Part.BrickColor = BrickColor.new('Really red')
end
end
end)
Report Abuse
reallycrazyBailey is not online. reallycrazyBailey
Joined: 29 Mar 2011
Total Posts: 28
03 Feb 2014 05:02 PM
You forgot a ')' after function()
Report Abuse
reallycrazyBailey is not online. reallycrazyBailey
Joined: 29 Mar 2011
Total Posts: 28
03 Feb 2014 05:03 PM
Wait, nevermind
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:03 PM
What about the second function?
Report Abuse
reallycrazyBailey is not online. reallycrazyBailey
Joined: 29 Mar 2011
Total Posts: 28
03 Feb 2014 05:04 PM
I think it's that you have to use two equal signs in if statements
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:04 PM
Oh. :/ Then what's wrong. D:
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:05 PM
It's only saying there is an error in line 3.
Report Abuse
xDeathBear is not online. xDeathBear
Joined: 09 Jul 2010
Total Posts: 1657
03 Feb 2014 05:05 PM
You need to use two equals when asking if something equals something else. One equal is to set something equal to something.
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:07 PM
Didn't change anything.
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
03 Feb 2014 05:11 PM
@People who didn't see all the errors, stop 'helping'.

This doesn't really make any sense. You're setting a parts Color, then asking if that part is the color you just set, then if it is, set it to red.
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:16 PM
Sorry, sorta my first script. I'm trying to make a script where each time you touch the brick, it's color changes.
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
03 Feb 2014 05:21 PM
local part = game.Workspace.Part
local db = true

part.Touched:connect(function(hit)
if hit.Parent and game.Players:findFirstChild(hit.Parent.Name) and db then
db = false
if part.BrickColor == BrickColor.new("Teal") then
part.BrickColor = BrickColor.new("Really red")
else
part.BrickColor = BrickColor.new("Teal")
end
wait()
db = true
end
end)
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:23 PM
Wait what's db
Report Abuse
deathdoor95 is not online. deathdoor95
Joined: 19 Feb 2010
Total Posts: 2080
03 Feb 2014 05:25 PM
db = debounce
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
03 Feb 2014 05:26 PM
It's a debounce, it keeps the script from running a bunch of times when you touch the brick.

http://wiki.roblox.com/index.php/Debounce
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 05:30 PM
Oh ok. Thanks.
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
03 Feb 2014 07:38 PM
Instead of individually naming colors, could I just make it random?
Report Abuse
dodleman is not online. dodleman
Joined: 22 Dec 2007
Total Posts: 1118
03 Feb 2014 07:39 PM
Yup

BrickColor = BrickColor.new(math.random(),math.random(),math.random())

I think there's an easier way but I don't know it.
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
03 Feb 2014 08:16 PM
BrickColor = BrickColor.random()
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
03 Feb 2014 08:19 PM
@dodle not a Color3 a brickcolor. Yours would also only be capable of creating white. You must divide each value by 255 for a random Color3.
Report Abuse
dodleman is not online. dodleman
Joined: 22 Dec 2007
Total Posts: 1118
03 Feb 2014 08:23 PM
LOL did you even test mine? It works perfectly :) no need for division or any of that crap.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
03 Feb 2014 08:27 PM
I thought you could only use 64 of the 16,581,375 possible combinations using Color3 as a BrickColor? (In online mode, that is, and without meshes).
Report Abuse
dodleman is not online. dodleman
Joined: 22 Dec 2007
Total Posts: 1118
03 Feb 2014 09:04 PM
Someone did some math.

BrickColors have their own color3 value (BrickColor.Color I think).
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
05 Feb 2014 06:33 AM
BrickColor.Color is actually how I get the RGB for when I'm making textures, LOL

But last time I checked, any of the Color3 combinations other than the 64 on the color palate wouldn't show up in online mode.

And again, that is without decals, textures, and/or meshes.
Report Abuse
Truste135 is not online. Truste135
Joined: 26 Oct 2010
Total Posts: 741
05 Feb 2014 06:43 AM
The color3.new(math.random(), math.random(), math.random()) works. I used it myself in my build tool, so don't go around talking crazy stuff as that doesn't work.

i'm not crazy just ask my toaster
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