Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change color of Drink Brick?

Im trying to make it change the color inside of a cup in game when I touch the machine for example touching a milk carton will fill the cup in your hand with milk?? Any help

function tch(h)
if (h.Parent.Name == "Iced Vanilla") then
script.Parent.Sound:Play()
h.Parent.Name = "Iced Vanilla Milk"
wait(0.5)
h.Parent.Handle.Brickcolor = script.Color.Value
h.Parent.Drink.BrickColor = script.Color.Value
h.Parent.Drink.Transparency = 0
end
end

script.Parent.Touched:connect(tch)

2 comments

0

How does your current code not meet your expectations?

0

?

1 answer

✓ Accepted answer

I'm not sure if this is your issue, but you are forgetting Brickcolor.new which defines what you want to change

Try this out:

function tch(h)
if (h.Parent.Name == "Iced Vanilla") then
script.Parent.Sound:Play()
h.Parent.Name = "Iced Vanilla Milk"
wait(0.5)
h.Parent.Handle.Brickcolor = Brickcolor.new("Brown")
h.Parent.Drink.BrickColor = Brickcolor.new("Brown")
h.Parent.Drink.Transparency = 0
end
end


3 comments

0

If it's a BrickColorValue, this will error.

0

It didn't work can you make it say the brick color like brown instead of script.Color.Value

0

Like that?

This discussion is preserved as it was. New answers, comments, and votes are closed.