hey hi how ya doing?
I’m working on a game and i’ve came to a bug which i’m not sure where to even begin to solve.
In this game you have Coins, these coins are multiplied based on Rebirths you own.
But, After a while i get my Coins at 9.2 quint, And it starts to go into Negetive numbers.
Script
--// Variables
local ds = game:GetService("DataStoreService"):GetDataStore("TestDataStore")
local Cache = {}
--// Functions
game.Players.PlayerRemoving:Connect(function(plr)
pcall(function()
ds:GetAsync(plr.UserId, Cache[plr.Name].Coins)
end)
for i = 1, #Cache do
if Cache[i] == plr.Name then
table.remove(Cache, i)
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local data = nil
pcall(function()
data = ds:GetAsync(plr.UserId)
end)
Cache[plr.Name] = {Coins = 0}
if data then
Cache[plr.Name].Coins = data
end
end)
The Script above showns what I’ve tried. But i think it’s a failure…
For example, Miner’s haven goes passed 9.2 quint and goes far beyond the limit.
I’m looking for a solution like that. I’m not asking for a Script to be made for me but only what i could try.
Thank you very much.