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

how to move player name in module script table to a different module script table?

I have 2 module script that i need to use for a spectate gui, 1 for alive and finished players and another one for dead players so players cant spectate players in the dead players table, but idk how to move them,

--the script

DeadPlayers = require(game.ServerStorage.DeadPlayers)
AlivePlayers = require(game.ServerStorage.FinishedAndAlivePlayers)
script.Parent.Touched:Connect(function(hit)
	for i,v in pairs(game.Players:GetPlayers()) do
		if hit:IsDescendantOf(v.Character) and not table.find(DeadPlayers,v) then
			if hit.parent.Humanoid then
				hit.Parent.Humanoid.Health = 0
				table.remove(ALivePlayers.--idkk)
				table.insert(DeadPlayers,1,v)	
			end
		end
	end
end)

1 comment

0

_G

1 answer

✓ Accepted answer

In line 8, you can do

table.remove(ALivePlayers,table.find(ALivePlayers,v))

table.find returns the index (number) of the found value. if table.find and can't found the value then it's nil.

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