game.Players.PlayerAdded:Connect(function(player)
local amount = 5
local timedelay = 2
local currencyname = "Money"
local Mad = player:FindFirstChild("GP").Mad.Value
while Mad == true do
wait(timedelay)
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v then
v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
end
end
end
end)
I have Mad set to true and Mad is in the leaderstats as a Boolean, but this still doesn't work.

2 comments
Ok lets break this down. Once a player joins, if Mads value == true we start a while loop, that will run in pairs for all players? Even if your script did work it makes no sense. Explain what you're trying to do, exactly.
im trying to make it so if the player owns the gamepass they get 5 money every 2 seconds