hello. So, I created a script that adds "+1" to the money of the player who touched a coin. apparently, the script is right, but some coins that the player touches (I don’t know if it’s a glitch or something I forgot to put in the script), instead of adding "+1" to your money, a much larger number is added (+3 or +4 ...) script:
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
db = false
local cointouchevent = game:GetService("ReplicatedStorage"):WaitForChild("Slotdata"):WaitForChild("CoinDestroy")
local hum = player.Character:WaitForChild("Humanoid")
pointsvalue = player:WaitForChild("leaderstats"):WaitForChild("Points")
local sound = Instance.new("Sound",player.PlayerGui)
sound.SoundId = 'rbxassetid://203620899'
sound.MaxDistance = 100
sound.Volume = 4
hum.Touched:Connect(function(hit)
if hit.Name == "Coin" then
if db == false then
db = true
print("more 1 money")
sound:Play()
pointsvalue.Value = pointsvalue.Value + 1
hit:Destroy()
db = false
end
end
end)
It is as if there was no Debounce (which I put to avoid spam.

12 comments
hello @ youtubermasterWOW. So, I tried, but if the wait is too long, when the player touches more than one currency, the value of your Money (Points) will not increase.
Try making the wait less longer.
Actually, try now. I've edited it.
Also, don't add the value on the client as it won't show for the server. Use a RemoteEvent.
what's wrong with it not being displayed by the server?
If it's not displayed by the server, when your changing a value or checking if a player has coins, it'll return 0 as of Filtering Enabled.
could I send this information to the server then? so that the player doesn't have a delay when picking up a coin
You'd also need a RemoteEvent for that.
so i need to put a remoteevent to inform the server how many Points does the player have?
I guess you could use ":FireServer(player.leaderstats.Points.Value)" BUT that would be easily exploited.
even with FilteringEnabled active?
Yes. Filtering Enabled is forced enabled now.