function OnClick()
local players = game.Players:GetPlayers()
for i=1,#players do
if (players[i]:FindFirstChild("leaderstats") ~= nil) then
local clicks = players[i]:FindFirstChild("leaderstats")["ParkBucks"]
if (clicks ~= nil) then
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Transparency = 1
clicks.Value = clicks.Value + 10
script.Parent.Sound:Play()
wait(20)
script.Parent.ClickDetector.MaxActivationDistance = 10
script.Parent.Transparency = 0
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(OnClick)
I do not know what is wrong with my script, when it regenerates it gives the previous player that clicked it the money instead of the "clicker". Any help will be greatly appreciated.

2 comments
This does not work
what doesnt work about it?