Im having trouble with removing an special index from a table

So basically, ive got a table that has the player inside as an index with some values inside and i wanna remove the player entirely from the table :
ive tried :

table.remove(playerDataStorage, table.find(playerDataStorage, player))

if i were to print the table this is what it would look like :

[Instance(taha_pro28,9224B15D7A8CA041)] = :arrow_forward: {…}

but this doesnt work as the index is the player. Any idea how to fix this?

1 Like

this is because table.find looks for the index with the value you provide it and returns an index as a number or nil if no index has that value. Instead you’ll have to use the player as the index

local playerDataStorage = {
    PlayerInstance = { money = 10 }
}
playerDataStorage[player] = nil
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.