that whole script or attatchment?
Probably just copy and paste what the other guy said instead of me, that looks like it will automatically save any new stuff you add to leaderstats while mine youre found to have to edit every time you want to add another thing that gets saved
ok i will try also pog cat when i use your script it doesnt save weapons anymore and it doesnt work with coins unless i put it in wrong
Whats your set up looking like? like your can you ss the old leaderstands and or send the script that makes the leaderstat folder and values?
You probably need to re set up loading the weapons to work with the new saving method (I didn’t read the whole script he sent so idk if this is already in there)
that broke my previous script sorry to ask but can somebody make me a much simplaler tool script that lets them carry across servers
its so jumbled i cant understand how to modify it
I FIGURED IT OUT
local DataStoreService = game:GetService(“DataStoreService”)
local PlayerCashStore = DataStoreService:GetDataStore(“PlayerCashStore”) – You can rename the string in quotation marks to whatever you want
function savedata(player) – Call this function whenever you need to save data
local success, err = pcall(function()
PlayerCashStore:SetAsync(player.UserId, player.leaderstats.Coins.Value)
end)
if success then
print(“Saved player’s data successfully!”)
else
print(err) – Prints the error that had happened
end
end
game.Players.PlayerRemoving:Connect(function(player) – When player leaves
savedata(player)
end)
game:BindToClose(function() – When server shuts down
for i, player in pairs(game.Players:GetPlayers()) do
savedata(player)
end
end)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
local Cash = Instance.new("IntValue") -- Cash can be renamed to whatever you want
Cash.Name = "Coins"
Cash.Parent = leaderstats
Cash.Value = PlayerCashStore:GetAsync(player.UserId) or 0
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.