New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why doesnt it work?

Asked by 4 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 146 — 4y
0
LoadObject is not a method of Player. You may have meant LoadInstance. 1waffle1 2863 — 4y
0
I'm trying to save stats for players when they leave and i have no errors. UltraUnitMode 419 — 4y

Answer this question