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

How do I make my tycoon accept bricks in a certain color?

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)

1 answer

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

5 comments

0

My leaderstats is "Cash" and my collect is "Money". The money collected goes in to cash when I use brick names.

0

i edited the script

0

And where would I put that line of code?

0

You have to figure out yourself or just put it where it says money.value = money.value + 100

0

Doesn't work.

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