The script gives players 5 Skulls(Cash) every minute. But I wanted to add a max limit on how many skulls the players can have at one time. when I tried, I realised that 'while true do' is a loop, and I'm not sure how to add the limit onto it, without breaking the script.
local function checkCash(player) local skulls = Instance.new("StringValue") skulls.Name = 'Skull Tokens' skulls.Parent = player local storage = Instance.new("Folder") storage.Name = player.Name.."'s Storage" storage.Parent = replicatedstorage local ServerSkulls = Instance.new("IntValue") ServerSkulls.Name = player.Name.."'s Skull Tokens" ServerSkulls.Parent = storage while true do if ServerSkulls.Value >= 0 then wait(60) ServerSkulls.Value = ServerSkulls.Value+5 skulls.Value = ServerSkulls.Value else if ServerSkulls.Value >= 1000000000000 then print(player.Name.." has Max Skulls") end end end end