I put strength, intelligence, defense, and health stat values in a folder in the player call playerstats and in another local script when a player levels up and adds points to that stat its suppose to go up which it does when I check the value, but when I try to save it using a script in serverscriptservice the values show up as 0.
local function savePointAllocation(player)
local playerstats = player.PlayerStats
local str = playerstats:FindFirstChild("Strength")
local def = playerstats:FindFirstChild("Defense")
local int = playerstats:FindFirstChild("Intelligence")
local hp = playerstats:FindFirstChild("Health")
local success, err = pcall (function()
local newStatValues = {
Strength = str.Value,
Defense = def.Value,
Intelligence = int.Value,
Health = hp.Value
}
plrStats:SetAsync(player.UserId.."Stats",newStatValues)
end)
if success then
print("Point allocation successfully saved!")
elseif not success then
repeat
print(err)
local newStatValues = {
Strength = str.Value,
Defense = def.Value,
Intelligence = int.Value,
Health = hp.Value
}
plrStats:SetAsync(player.UserId.."Stats",newStatValues)
until success
end
end
game.Players.PlayerRemoving:Connect(function(player)
savePointAllocation(player)
end)

2 comments
Is this a localscript?
its a script inside the serverscripservice