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

How can I solve this Pizza Cooker Error?

Asked by 4 years ago
Edited 4 years ago

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)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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 )

Ad
Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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")

Answer this question