Also, I have to ask, if you are a beginner scripter why are you scripting for a game with 2000+ players?
I’m not the scripter there, We don’t have enough to pay for scripters so we’re using scripts we are seeing on youtube/dev forum
Oh, okay. Obviously in the future I reccomend writing your own scripts. As for right now, do some research on data stores and look for solutions.
1 Like
That’s what it’s saying, How do I fix it?
That’s what I did right now:
--[[Savin'
Dem
Stats
--]]
game.Players.PlayerRemoving:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.UserId.."Stats")
local statstorage = player:FindFirstChild("leaderstats"):GetChildren()
for i = 1, #statstorage do
datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
print("saved data number "..i)
end
print("Stats successfully saved")
end)
--[[
Loadin'
Dem
Stats
--]]
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.UserId.."Stats")
player:WaitForChild("leaderstats")
wait(1)
local stats = player:FindFirstChild("leaderstats"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
print("stat numba "..i.." has been found")
end
end)
DataToTransfer = DataStore1:GetAsync(player.Name) --if you are saving by UserId, Key would be the user you want to work with's UserId
DataStore2 = DataStore2:SetAsync(player.UserId, DataToTransfer) --Set the value of the second DataStore to the value of the first
1 Like
You didnt change the data store names in the code I gave you…
If this isn’t resolved In about 3 hours I’ll be able to help you on my pc
Please do not ask for code, as it is against the rules.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.