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

Bad argument #3 to BrickColor (expected BrickColor, got string)?

Asked by 4 years ago

So, i want my part to change it's brickcolor and material when clicked, but it isn't doing that.

My code: (it's in a normal script)

local ClickDetector = script.Parent.ClickDetector
local ogien1 = script.Parent.Parent.ogienjeden.Fire
local ogien2 = script.Parent.Parent.ogiendwa.Fire
local ogien3 = script.Parent.Parent.ogientrzy.Fire
local ogien4 = script.Parent.Parent.ogiencztery.Fire
local ogien5 = script.Parent.Parent.ogienpiec.Fire
local sound = script.Parent.Parent.seinfeld
local part = script.Parent.Parent.Glowna

ClickDetector.MouseClick:connect(function(plr)
   ogien1.Enabled = true
   ogien2.Enabled = true
   ogien3.Enabled = true
   ogien4.Enabled = true
   ogien5.Enabled = true
   part.BrickColor = tostring("Burnt Sienna") -- this is the line that im getting the error from
   part.Material = tostring("CorrodedMetal") -- this would be the line that i will get an error from, but it isn't executing because of the first line getting an error
   local ramka = plr.PlayerGui.ScreenGui.Frame
   local tekst = ramka.TextLabel
   sound.Playing = true
   sound.Volume = 5
   ramka.Visible = true
   tekst.Text = "Kto? podpali? automat biletowy przy zajezdni ?odygowa. *klap klask*"
   wait(5)
   ramka.Visible = false
   tekst.Text = ""
end)

1 answer

Log in to vote
1
Answered by 4 years ago

line 16 error is that you are using a string instead of BrickColor

--//Line 16 should look like this
part.BrickColor = BrickColor.new("Burnt Sienna")
--//Line 17 is 
part.Material = Enum.Material.CorrodedMetal
Ad

Answer this question