I'm completely new to using the save feature on Roblox. I realize this won't work because I'm trying to locate a local player using a regular script. This scripts parent is ServerScriptService. How do I successfully go about saving this type of user data?
local Leaderboard = game.Players.LocalPlayer:WaitForChild("leaderstats")
game.Players.PlayerRemoving:connect(function(plr)
local key = plr.UserId
game:GetService'DataStoreService':GetDataStore('Data'):SetAsync(key, plr.leaderstats.RankVal.Value)
end)
