I made a script that gives players who own the Vip gamepass +5 Cash every 60 seconds but it’s not working, can anyone tell me why?
Here’s it:
local mps = game:GetService("MarketplaceService")
local vip = 13261240
game.Players.PlayerAdded:Connect(function(plr)
if mps:PlayerOwnsAsset(plr, vip) then
while wait(60) do
plr.leaderstats.Cash.Value += 5
end
end
end)
I think it’s probably because you didn’t do CharacterAdded event, you should do it because in this case if a player respawns, they won’t get their cash anymore as PlayerAdded event only FIRES when a new player joins the game, not when your character is loaded.
local mps = game:GetService("MarketplaceService")
local vip = 13261240
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()
if mps:PlayerOwnsAsset(plr, vip) then
while wait(1) do
plr.leaderstats.Cash.Value += 5
end
end
end)
end)