Prev: I'm trying to make a script that every 100 seconds (Right now I set it to 1 for testing purposes) We get 100 gold. There are weird bugs, for example some players do not get the money. I also have another problem, I'm trying to make it permanent with data stores, but the data stores are really weird and either dont work for some people or some people have MY data store... Now: I've narrowed down my problem. For some reason, whomever joins first will receive the money, as if there is only one data store for the entire server and only one player can access it. Also, whomever that player is will continue to get money, but no one else. If I were to join first after that, I would start out with the same amount of money they had when they left and I would continue to get more..
Script: CashStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
game.Players.PlayerAdded:connect(function(p) local data = Instance.new("Folder") data.Name = "PlayerData" data.Parent = p local stats = Instance.new("IntValue") stats.Name = "leaderstats" stats.Parent = p local gold = Instance.new("IntValue") gold.Name = "Gold" gold.Parent = stats
if CashStore:GetAsync("Points_"..p.Name) ~= nil then gold.Value = CashStore:GetAsync("Points_"..p.Name) else gold.Value = 0 end
gold.Changed:connect(function(Val) CashStore:SetAsync("Points_"..p.Name, Val) end)
--[[if CashStore:GetAsync('Tools_'..p.UserId) ~= nil then local a = game:GetService('ReplicatedStorage'):FindFirstChild(CashStore:GetAsync('Tools_'..p.UserId)) a:Clone().Parent = p.StarterGear end]]
while wait(1) do gold.Value = gold.Value + 100 end end)

4 comments
It would be nice if you commented instead of answered
I dont know how to comment normaly :/
One cannot comment if they have below 0 EXP I believe
Oh overscores burn, idc that was good, but yeah i think they can comment.