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: Not sure why this isn't working, need help.

Previous Thread :: Next Thread 
FruitTheRobot is not online. FruitTheRobot
Joined: 24 Jul 2011
Total Posts: 8801
03 Jul 2013 03:56 PM
I want the tool to morph to the color of the wearer's arm, however the console is saying this:
Workspace.Player1.Fruit's Justice Claw.Script:7: bad argument #1 to 'new' (Color3 expected, got userdata)

The script is:

function onEquipped()
for _, v in pairs(script.Parent:GetChildren()) do
ra = script.Parent.Parent:FindFirstChild("Right Arm")
if ra then
rac = ra.BrickColor
print(rac)
v.BrickColor = BrickColor.new(rac)
end
end
end


script.Parent.Equipped:connect(onEquipped)

Now, being the novice I am, I have no idea what's wrong, and help would be much appreciated.
Report Abuse
kinglime is not online. kinglime
Joined: 27 Jun 2008
Total Posts: 2751
03 Jul 2013 04:00 PM
ra = script.Parent.Parent:FindFirstChild(["Right Arm"])
Report Abuse
FruitTheRobot is not online. FruitTheRobot
Joined: 24 Jul 2011
Total Posts: 8801
03 Jul 2013 04:03 PM
kinglime,
First of all, that isn't working.
Second of all, an explanation of what's actually wrong would help.
Report Abuse
kinglime is not online. kinglime
Joined: 27 Jun 2008
Total Posts: 2751
03 Jul 2013 04:05 PM
This is the only thing I see wrong with it...
When using something with a space, example Right Arm,Left Arm, Right Leg, Left Leg you must put it between [" "]
Report Abuse
FruitTheRobot is not online. FruitTheRobot
Joined: 24 Jul 2011
Total Posts: 8801
03 Jul 2013 04:14 PM
Hm. Well, when I use what you said, the error it returned was this if it helps at all:
17:14:05.984 - Players.Player1.Backpack.Fruit's Justice Claw.Script:3: unexpected symbol near ']'
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Jul 2013 04:25 PM
function onEquipped()
for _, v in pairs(script.Parent:GetChildren()) do
ra = script.Parent.Parent:FindFirstChild("Right Arm")
if ra then
rac = ra.BrickColor
print(rac)
v.BrickColor = rac
end
end
end


script.Parent.Equipped:connect(onEquipped)
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