When the server loads a character a new table is made in a module script using setmetatable. This table has all the characters stats for the game and their inventory and whatever else. Basically I’ve just now realized that apparently when the player dies it’s not using their new table, but their old one still. So basically on the next game they will have all the items and inventory from the previous game.
function Character.new(Plr, Gamemode: number)--This gets called every time I do player:LoadCharacter() on the server
local newChar = setmetatable({
Player = Plr,
CharStats = CharacterStats.new(Gamemode),--it's really these pesky charstats that don't want to reset despite me setting it to nil down below
}, Character)
local Humanoid = Plr.Character.Humanoid
table.insert(Characters, newChar)--This characters table is where I put the table to access it later
Humanoid.Died:Connect(function()--This is how I'm currently trying to wipe the players data
for i = 1, #Characters do
if Characters[i].Player == Plr then
Characters[i].Player = nil
Characters[i] = nil
newChar.CharStats = nil
newChar = nil
end
end
end)
end