local brick = script.Parent
function onTouched(hit)
for i,player in ipairs(game.Players:GetPlayers()) do
if player.Character then
local stat = player:FindFirstChild("leaderstats")
if stat then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +50
brick:Destroy()
end
end
end
end
brick.Touched:connect(onTouched)
I used this script and put it inside the part that gives coins, when the player touches it, it disappears and gives 50 coins, only problem is that it gives 50 coins to everyone.

1 comment
NICCO is right on line 4 you did game.Player:GetPlayers()) which will get all players not just the one you want