Well I’m pretty sure that it will but I think it wouldn’t matter anyway because your previous data store script wasn’t saving it and also on this part of the script,
local function AutomaticSave()
while wait(1) do
for i, Player in pairs(game:GetService("Players"):GetPlayers()) do
Save(Player)
end
end
end
while wait(1) do that’s the time it automatically saves the data, so the player’s data would be saved every second and I recommend that you keep it like that in case of any disconnections from the game, etcetera but always feel free to change the number from one to something else.
Also if the script worked please let me know and make sure to mark is as a solution, thanks.
It’s fine I can just add back some stats since most of them were my friends, well I’ll get going to sleep now, bye. I’ll let you know if It works when I get on studio in the morning
ok, i tried it, everything works, just like before except for my problem. When the player gets the tool, then leaves they’re stats stay the same way they were before the purchase. I dont think anything was wrong with my data store script, i just think something was wrong in the tool purchase script, as i mentioned earlier in the topic.
Is something wrong with this local script on my textbutton
player = game.Players.LocalPlayer
backpack = player.Backpack
script.Parent.MouseButton1Click:Connect(function()
local SpeedCoil = game.ReplicatedStorage.Tools.SpeedCoil:Clone()
if player.leaderstats.Credits.Value >= 100 then
player.leaderstats.Credits.Value = player.leaderstats.Credits.Value - 100
SpeedCoil.Parent = backpack
end
end)
Does this need datastore, I don’t think anything was wrong with my data store script before as I mentioned in the beginning of the topic, my problem was when a tool was brought, the stats gave them a refund when they left. So now I’m stuck right where I started.