Not sure why, but my code worked before, and now it doesn't. I basically have a tycoon that whenever you buy the mine for free, a model appears (aka the mine) and when you click the button this code is triggered.
I didn't change anything in the mine script. I don't get errors either. My only thoughts are the TeamColor part, that could somehow get messed up for no reason.
Here is a link to the picture of my hierarchy. Picture
For my tycoon, I have a IntValue named "Owner". This changes whenever a player owns the tycoon. Except, it doesn't work. Help?
debounce = false
tycoonOwner = script.Parent.Parent.Parent.Owner.Value
script.Parent.Button.ClickDetector.MouseClick:connect(function(clicker)
if debounce == false and clicker.Name == tycoonOwner then
debounce = true
script.Parent.Button.BrickColor = BrickColor.new("Bright red")
local part = Instance.new("Part", workspace)
local cash = Instance.new("IntValue", part)
cash.Name = "Cash"
part.FormFactor = "Custom"
part.BrickColor = script.Parent.Parent.Parent.DropColor.Value
cash.Value = 1
part.CFrame = script.Parent.Drop.CFrame
part.Size = Vector3.new(0.2, 1, 1)
game.Debris:AddItem(part, 7)
wait(0.2)
debounce = false
script.Parent.Button.BrickColor = BrickColor.new("Bright green")
end
end)

1 comment
Try putting 'print(clicker.TeamColor)' and see what comes out