Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Function is not removing player from table?

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
	while true do
		wait()
		if workspace.Values.Classic == true then
			char:WaitForChild('Humanoid').Died:connect(function()
				for i,v in pairs (_G.Playing) do
					if plr.Name == v then
						table.remove(_G.Playing, i)
						end
					end
			end)
			end
			end
		end)
	end)

I think the problem may be the while true do loop, but basically this finds the global table '_G.Playing ' and when the player dies it removes it, but if it removes it the next script doesnt find that the player is gone. I've been looking all day for an answer and fixed alot of things, this just seems to slip through the crack... Looking for any answer, thank you!

1 comment

0

While true do loop shouldn't be there. Is the Classic object a BoolValue? If so, you forgot to add .Value. Try printing some lines and indicate where the script may be stopping. In conjunction, print the contents of the table to find out whose names have been removed from the list. This may help to solving your issue or help us help you.

1 answer

repeat wait() until char:FindFirstChild("Humanoid")
repeat wait() until game.Workspace.Classic.Value==true
char.Humanoid.Died:connect(function()
for i,v in pairs(_G.Playing)do
if v==char.Name then
_G.Playing[i]=nil
end
end
end)

2 comments

0

May i please have an explanation to this, your answer doesnt do me any good.

0

Ok, I'll edit it.

This discussion is preserved as it was. New answers, comments, and votes are closed.