Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

guys, some character body parts has spaces, and my localscript doesnt work because of the spaces [?]

Asked by 4 years ago
script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.Character.["Right Arm"].BrickColor = BrickColor.new("Black")
    script.Parent.Parent.Parent.RIGHTARM.Text = "Black"
    script.Parent.Parent.Parent.RIGHTARM.BackgroundColor3 = Color3.fromRGB(27,42,53)
end)

a button that changes the right arm color, but it doesnt work because of the character, what is the problem?

0
~~~~~~~~~~~~~~~~~game.Players.LocalPlayer.Character.["Right Arm"].BrickColor = BrickColor("Black")~~~~~~~~~~~~~~~~~ IvanJupiter 36 — 4y
0
it didnt work RafaelCraft16 -15 — 4y
0
How about you try to remove the spaces in the name of the body part? SUPERMEGADANTHEMAN 33 — 4y
0
i cant do a script that changes the name of the body part, it doesnt work :/ RafaelCraft16 -15 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Change Character.["Right Arm"].BrickColor to Character["Right Arm"].BrickColor, removing the dot By using . you are signifying that you want to index something, but right after that you use [] signifying again that you want to index something. Lua doesn't like this, so it'll throw a syntax error.

Ad

Answer this question