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

Furnace script not working?

Asked by 8 years ago

So, I'm making a tycoon (with this furnace of course), but when I tested it, I joined the green team, then make a mine go into the furnace. The problem is I won't get the money from it. Any help?

script.Parent.Touched:connect(function(hit)
    if hit.Name == "Ore" then
        for i,v in pairs(game.Players:GetChildren())do
            if v.TeamColor == "Lime green" then
                v.leaderstats.Money.Value = v.leaderstats.Money.Value + hit.OreValue.Value
hit:Destroy()


            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by 8 years ago

Player.TeamColor is a BrickColor value, so you need to compare it with another BrickColor value, not a string as you are doing.

Changing it to

 if v.TeamColor == BrickColor.new("Lime green") then

...should fix your problems, assuming something else isn't wrong.

Ad

Answer this question