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

(?) Please help me with this basic script would really help, have a good day :)

Asked by 4 years ago
Edited by M39a9am3R 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
g = game.Workspace.Part 

if g.Material == ("Plastic") then
    g.BrickColor.new = ("Bright red") 
end

-- using "Plastic" doesnt work

-- "Bright red" doesnt work either / tried Brickcolor3 aswell.

-- I really want to know what Im doing wrong, kinda poor at scripting. thought this would be really easy.

0
Watch the language! Profanity is not permitted on this site. M39a9am3R 3210 — 4y
0
Why do u need to change "kinda shit" to "kinda poor" like why do u care about the word "shit", second of all why are u even editing a 2 months old question.... xd popu2004 42 — 4y

1 answer

Log in to vote
1
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
4 years ago

Material requires an enum, so you have to do:

if g.Material == Enum.Material.Plastic then

end

Or you can do:

if g.Material.Name == "Plastic" then

end

The property to change a part's colour is BrickColor, which requires a BrickColor object.

g.BrickColor = BrickColor.new("Bright red")
0
ty popu2004 42 — 4y
Ad

Answer this question