Here's my situation, i've made a coin mesh and added a script to it that makes the coin spin and when picked up makes a sound and adds to the players leaderstats value. It disappears for 5 seconds before regenerating to make a new coin. Is there anyway to make it so if a player picks up a coin they have already picked up maybe a few minutes earlier, they aren't able to pick it up again without changing the wait and db value for everyone else in the server?
while wait(0.05) do
CoinPart.CFrame = CoinPart.CFrame * CFrame.Angles(0.05,0,0)
local function onTouched(CoinPart)
local player = Players:GetPlayerFromCharacter(CoinPart.Parent)
if not player then return end
if db == false then
db = true
CoinTween1:Play()
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
Sound:Play()
wait(5)
CoinTween2:Play()
db = false
end
Here is part of my script, the rest is just the info for tweens and basic variables.

1 comment
Is this a local script or a server script?