Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesnt it work?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I'm i doing it right?

ServerStorage = game:GetService('ServerStorage')
game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
local PlayersStats = Instance.new("ObjectValue", ServerStorage)
PlayersStats.Name = plr.Name.."_Stats"
local NewPlayerStats = Instance.new("BoolValue", PlayersStats)
NewPlayerStats.Name = "NewPlayer"
NewPlayerStats.Value = true
----------------------------------------
local PlayerStatsSaved = plr:LoadObject("PlayersStats")
local SavedNewPlayerStats = plr:SaveBoolean("NewPlayerStats")
if SavedNewPlayerStats == true then
SavedNewPlayerStats = false
end
NewPlayerStats.Value = SavedNewPlayerStats

end)

game.Players.PlayerRemoving:connect(function(plr)
plr:WaitForDataReady()
local PlayersStats = ServerStorage:FindFirstChild(plr.Name.."_Stats")
if not PlayersStats then return end
local NewPlayerStats = ServerStorage:FindFirstChild(NewPlayerStats.NewPlayer)
if not NewPlayerStats then return end
plr:SaveBoolean("NewPlayerStats", false)
end)

1
Please explain a little more on what you're trying to accomplish, and post any error message if there are any. GShocked 150 — 8y
0
LoadObject is not a method of Player. You may have meant LoadInstance. 1waffle1 2908 — 8y
0
I'm trying to save stats for players when they leave and i have no errors. UltraUnitMode 419 — 8y

Answer this question