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

How to change Brick color of cup on touch?

Asked by 9 years ago

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

0
could you use the "code block" format and put the code in that?reading the code as-is is impossible lukeb50 631 — 9y
0
Agree. Too hard. But do you want the whole cup to change color? Vezious 310 — 9y
0
How Do you do that? Glassify 15 — 9y
0
before putting your code into the post,click the button with the LUA logo and paste the code inside lines it creates lukeb50 631 — 9y
0
Make everything a union. it will be easier for your life TrollD3 105 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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.

0
It didnt work I want it to change the color of the cup handle not the brickcolor of the machine Glassify 15 — 9y
Ad

Answer this question