I'm currently working on a tycoon and was wondering how I could make my tycoon money-getter accept a brick of a certain color. Right now I have the money-getter accept bricks by their name.
money = script.Parent.Parent.Money
function onTouched(hit)
if hit.Name == "TycoonBrick1" then
hit:remove()
money.Value = money.Value + 50
elseif hit.Name == "TycoonBrick2" then
hit:remove()
money.Value = money.Value + 100
end
end
script.Parent.Touched:connect(onTouched)
I've tried codes such as...
money = script.Parent.Parent.Money
function onTouched(hit)
if hit.BrickColor == "Bright blue" then
hit:remove()
money.Value = money.Value + 50
elseif hit.BrickColor "Bright red" then
hit:remove()
money.Value = money.Value + 100
end
end
script.Parent.Touched:connect(onTouched)
money = script.Parent.Parent.Money
function onTouched(part)
if part.BrickColor == "Bright blue" then
part:remove()
money.Value = money.Value + 50
elseif part.BrickColor "Bright red" then
part:remove()
money.Value = money.Value + 100
end
end
script.Parent.Touched:connect(onTouched)

5 comments
My leaderstats is "Cash" and my collect is "Money". The money collected goes in to cash when I use brick names.
i edited the script
And where would I put that line of code?
You have to figure out yourself or just put it where it says money.value = money.value + 100
Doesn't work.