Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Argument 2 missing or nil? showing error when running

Asked by 5 years ago

game.Players.PlayerRemoving:connect(function(player)

store:SetAsync(player.UserId, dir[player.Name])

dir[player.Name] = nil

end)

0
The error explains itself: There is no index in the table that has the same name as the player's name. DeceptiveCaster 3761 — 5y
0
A way to fix this is to add the player's name to the table using PlayerAdded, and then check if the leaving player's name is in the table. If so, the index will not be nil. DeceptiveCaster 3761 — 5y

Answer this question