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 » Scripters
Home Search
 

What's wrong with this?

Previous Thread :: Next Thread 
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 02:53 PM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char))
bodyColor = char:WaitFor("Body Colors")
player.CanLoadCharacterAppearance = false

for _, v in next, char:GetChildren() do
if v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") then
v:Destroy()

bodyColor.HeadColor = BrickColor.new("125")
bodyColor.TorsoColor = BrickColor.new("125")
bodyColor.LeftArmColor = BrickColor.new("125")
bodyColor.RightArmColor = BrickColor.new("125")
bodyColor.LeftLegColor = BrickColor.new("125")
bodyColor.RightLegColor = BrickColor.new("125")
end
end

local shirt_texture = "rbxassetid://237745250"
local pants_texture = "rbxassetid://237745353"

local hats_id = {
1073690,
}

Instance.new("Shirt", char).ShirtTemplate = shirt_texture
Instance.new("Pants", char).PantsTemplate = pants_texture

for _, v in next, hats_id do
game:GetService("InsertService"):LoadAsset(v):GetChildren()[1].Parent = char
end

end)
end)
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 02:54 PM
Be more specific. You're not going to get much help by posting a huge code chunk and asking "what's wrong with this" without any explanation.
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 02:56 PM
It's to do with the brackets, at line 2. But when I remove a bracket, then the bodyColor code gets W003.
Report Abuse
Tokimonu is not online. Tokimonu
Joined: 18 Sep 2009
Total Posts: 643
19 Apr 2015 02:58 PM
try dividing the integers by 255, and rather than
("Body Colors")

try
(["Body Colors"])

bark
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 02:58 PM
What does the output say?
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 02:59 PM
"WaitFor" I'm pretty sure should be "WaitForChild" unless WaitFor is some obscure alternative I've never heard of.
Report Abuse
Tokimonu is not online. Tokimonu
Joined: 18 Sep 2009
Total Posts: 643
19 Apr 2015 03:00 PM
oh yeah, @NotAshley is right,
it's :WaitForChild()


bark
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:00 PM
I did what Tokimonu says. Now the output says ServerScriptService.Script:3: unexpected symbol near '['

Right now I replaced bodyColor = char:WaitFor("Body Colors") with
bodyColor = char:WaitFor[("Body Colors")]
Report Abuse
Tokimonu is not online. Tokimonu
Joined: 18 Sep 2009
Total Posts: 643
19 Apr 2015 03:01 PM
also, here:

local hats_id = {
1073690,
}

it should probably be in brackets, and if there's no other values in the table make the comma skidaddle

local hats_id = {
"1073690"
}


bark
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:01 PM
char:WaitFor[("Body Colors")]

This is extremely incorrect. The square brackets are for finding values in tables.

It should be this:

char:WaitForChild("Body Colors")
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:02 PM
bodyColor has a W003 underline now.
Report Abuse
Tokimonu is not online. Tokimonu
Joined: 18 Sep 2009
Total Posts: 643
19 Apr 2015 03:02 PM
nOOOOOOOOOOOOO

u r doin dis all wrong

local bv = "Body Colors"
local bodyColor = char:WaitForChild(..bv)

do that if it won't accept the space for whatever reason

also yay 300 posts


bark
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:03 PM
Also, keep the numbers without quotes. LoadAsset takes number values and not strings. The other poster doesn't seem to know what he's talking about.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:04 PM
"local bodyColor = char:WaitForChild(..bv)"

This won't work at all. The two dots are the concatenation operator, and there's nothing to concatenate.
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:05 PM
So what should I do with bodyColor. It has a W003 underline now.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:06 PM
bodyColor = char:WaitForChild("Body Colors")
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:06 PM
Still has underline.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:07 PM
What does it say when you hover the mouse over the outline?
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:07 PM
underline*
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:09 PM
W003: Global 'bodyColor' is only used in enclosing function; consider changing it to a local.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
19 Apr 2015 03:09 PM
Define bodycolor! Of course!
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
19 Apr 2015 03:10 PM
That's a warning, it won't error your code. Although that means you're using that variable inside the function and it wants you to set it to local, meaning nothing outside that function will be able to see it.

Just change it to:

local bodyColor = char:WaitFor("Body Colors")
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
19 Apr 2015 03:10 PM
Oh wait, you did. Sorry. One second.
Report Abuse
Tokimonu is not online. Tokimonu
Joined: 18 Sep 2009
Total Posts: 643
19 Apr 2015 03:12 PM
erm, the textureid's for the shirt and pants are both shirts.
is that intended?


bark
Report Abuse
VilliusIV is not online. VilliusIV
Joined: 24 Jun 2014
Total Posts: 107
19 Apr 2015 03:13 PM
WaitFor is not a valid member of Model
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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