I’m using a table and a matchStarted variable to aid my logic in determining whether the player is in the Dueling table that they need to be removed and respawn the other play which they are dueling and the vice-versa if they were in the holding table or “Participants” they need to be removed from it. – As I’m writing this part, I’m realizing that I could just accomplish the same thing without needing the matchStarted variable because I could just check if the player that is being passed into the function if they are in either table and then go from there, but that is where I’m actually having issues.
I can’t seem to use Dueling[player] to determine whether or not if the player is in the table or the same for Participants.
Here is what I have so far ( I should just try to get rid of matchStarted in the logic and just see if they are in the table or not and do from there )
Players.PlayerRemoving:connect(function(player)
print(matchStarted) -- debugging
if matchStarted == true and table.find(Dueling, player) then
table.remove(Dueling, table.find(Dueling, player)) -- remove player disconnecting
print(Dueling) -- debugging
local respawn = table.unpack(Dueling) -- var
local person = Players:FindFirstChild(respawn) -- var
print(table.unpack(Dueling)) -- debugging
person:LoadCharacter() -- respawn the other dueler
table.remove(Dueling, 1) -- take that dueler out of Dueling
elseif matchStarted == false or table.find(Participants, player) then
table.remove(Participants, table.find(Participants, player)) -- remove disconnecting player
print(Participants) -- debugging
end end)
Thanks for any help.