Hello
I am trying to make a coin system where players can collect a coin that that then disappears. I want everyone to be able to collect the coin though and i don't know how to make it disappear or deactivate for only one player once they've collected it and still work for those who haven't collected it yet. Here is the code i am using
local ting = 0
function onTouched(hit)
if ting == 0 then
ting = 1
local check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")
if stats ~= nil then
local wins = stats:findFirstChild("Wins")
wins.Value = wins.Value +1
wait(120)
end
end
ting = 0
end
end
script.Parent.Touched:connect(onTouched)
There is a wait function after the currency is added but this seems to disactivate the coin for all players. I want it to still work for the ones who haven't touched it yet.
Thanks!
