I'm bug fixing and making sure that once a part in a tool changes colour, it stays that colour by doing a simple check. Here is the code that I have tried so far:
-- Adding vanilla flavour game.Workspace.flavours.addVanillaFlavour.Touched:Connect(function(Object) if Object.Parent:FindFirstChild("Milk") then if Object.Parent.Milk.BrickColor == ("Institutional white") then Object.Parent.Milk.BrickColor = BrickColor.new("Cool yellow") Object.Parent.Parent.Name = ("Milk with Vanilla") end end end)
The problem is 100% the if statement checking if the colour is Institutional white, but I'm unsure of why it isn't working as when I remove that line it works normally.
However, there is a problem saying 'BrickColor is not a valid member of Tool', even though if I remove the if statement the code still works. If you understand what I mean, please be sure to answer! :)
Object.Parent.Milk.BrickColor == ("Institutional white")
this compares a BrickColor to a String, which obviously will never be true
try
Object.Parent.Milk.BrickColor == BrickColor.new("Institutional white")