Okay, so I am making smoothies and there is multiple flavours, they start by getting milk and everything works fine, but when it goes to one of the flavours it only changes the name and not the colour based on the flavour.
The script is:
function tch(h)
if (h.Parent.Name == "Milk") then
h.Parent.Name = "MangoSmoothie"
wait(0.5)
h.Drink.BrickColor = script.Color.Value
h.Drink.Transparency = 0
end
end
script.Parent.Touched:connect(tch)
The script links to a value, and the value has colours.
The colour is different per flavour however when I try to run the script I get the following error:
function tch(h)
if (h.Parent.Name == "Milk") then
h.Parent.Name = "MangoSmoothie"
wait(0.5)
h.Parent.Drink.BrickColor = script.Color.Value
h.Parent.Drink.Transparency = 0
end
end
It doesn’t need to be, it starts of as cup, then it goes to milk then the script checks if the name is milk and if it is it changes the name to Mango Smoothie and is supposed to change the colour,
Yes! It changes the name in your inventory from Milk to Mango Smoothie, all I need is for it to change the colour of the invisible part known as drink to the colour that is connected to the value, making the transparency to 1 and changing the colour to the one linked to the script like I showed in the screenshots.
I think your problem is that “Mango” in Explorer is not a MeshPart. It’s a model. It looks like you’re trying to contact a MeshPart in your script instead of the model.
function tch(h)
if (h.Parent.Name == "Milk") then
h.Parent.Name = "MangoSmoothie"
wait(0.5)
h.Parent.Drink.BrickColor = script.Color.Value
h.Parent.Drink.Transparency = 0
end
end