I'm making a pizza cooker that cooks the pizza once assembled but I'm getting an error that causes the pizza to not cook like it does not wanna change the dough color and doesnt wanna change the transparency for the toppings and I can't fix the problem I've tried redoing the script but this is what pops up on the game console: line 19: bad argument #3 (Color expected, got BrickColor) Stack Begin Script, line 19 - function tch Stack End
This is the code.
--// --SavageDarry-- --// Base = "Dough" MainSound = "128216507" SecondSound = "128216507" Action = "Cook" function Main() script.Parent.Sound.SoundId = "http://www.roblox.com/asset/?id="..MainSound script.Parent.Sound:Play() end function tch(y) if y.Parent.Name == "Raw Cheese Pizza" then Main() y.Parent.Name = "Cheese Pizza" y.Parent.RawDough.Color = BrickColor.new("Br. yellowish orange") y.Parent.CookedCheese.Transparency = 0 y.Parent.UncookedCheese.Transparency = 1 print("Cooked Cheese Pizza") end end script.Parent.Touched:connect(tch) function tch(y) if y.Parent.Name == "Raw Cheese Pizza w/ Onions" then Main() y.Parent.Name = "Cheese Pizza w/ Onions" y.Parent.RawDough.Color = BrickColor.new("Br. yellowish orange") y.Parent.CookedCheese.Transparency = 0 y.Parent.UncookedCheese.Transparency = 1 print("Cooked Cheese Pizza w/ Onions") end end script.Parent.Touched:connect(tch)
Starting with line 19, Color3 values (made with 3 numbers) (the type of value the property needs) and brickcolor values (which can be made with a string) are two different values.
I suggest changing the property into BrickColor instead of Color, or change the value into a Color3 Value (ie Color3.fromRGB(255,0,0)
Red color )
This means that you are trying to cast a datatype that is contradictory to the datatype the attribute expects. I suggest you use the BrickColor
property to cast properly, as Color
requires a Color3
Object.
RawDough.BrickColor = BrickColor.new("Br. yellowish orange")