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 Brick color of cup on touch?

So I was wondering how I could possibly change the brick color of a drink in it When put in the machine?? This is the script I have right now? Any help?

function tch(h)
if (h.Parent.Name == "Cup") then
script.Parent.Sound:Play()
game.Workspace.ChocolateMachine.Spill.Transparency = 0
h.Parent.Name = "Chocolate Ice Cream"
wait(0.5)
game.Workspace.ChocolateMachine.Spill.Transparency = 1
h.Parent.Drink.BrickColor = script.Color.Value
h.Parent.Drink.Transparency = 0
end
end

script.Parent.Touched:connect(tch)

So I have my Brick named Drink when a cup get's touched on the part Brick It will change a brick in the cup that was touched to a certain color and the spill is the ice cream dropping

I want it to change the color of the drink in workspace when playing the game so If someone puts their cup in the machine their Drink will turn brown or something?

-Glassify

5 comments

0

could you use the "code block" format and put the code in that?reading the code as-is is impossible

0

Agree. Too hard. But do you want the whole cup to change color?

0

How Do you do that?

0

before putting your code into the post,click the button with the LUA logo and paste the code inside lines it creates

0

Make everything a union. it will be easier for your life

1 answer

✓ Accepted answer

To set the color of a part, set the BrickColor of the part to BrickColor.new("Cocoa")

 h.Parent.Drink.BrickColor = BrickColor.new("Cocoa")

Replace Cocoa with the name of whatever BrickColor you want, Cocoa is just my example/recommendation.

1 comment

0

It didnt work I want it to change the color of the cup handle not the brickcolor of the machine

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