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)
I think the problem is that you haven't mentioned anything about leaderstats , unless your script understands what you are talking about.
or try something like
FindFirstPlayer.leaderstats.money.Value + 100
i dont want to give you the whole script