Server:
local Players = game:GetService("Players") game.ReplicatedStorage.Remotes.died.OnServerEvent:Connect(function(dr) if table.find(Array, dr) then table.remove(Array, dr) print(dr .. " was eliminated!") else print("Player was already eliminated") print(Array) end end)
Localscript: local Player = game.Players.LocalPlayer local Char = Player.Character local dataSend = script.Parent.Parent.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local died = ReplicatedStorage.Remotes.died print("Death Script Ready!") print(Player) Char:WaitForChild("Humanoid").Died:Connect(function() died:FireServer(dataSend) print("FIRED!") end)function getPlayers() for _,v in ipairs(game.Players:GetPlayers()) do table.insert(Array,v.Name); print(Array) end end
Script to grab players:
So I'm trying to make a basic system to tell if a certain player has been eliminated from the round and I'm having trouble with the death system. I just want it to remove the player from the array but instead it just says that they already don't exist
table.remove looks for the index so you could do table.remove(array, table.find(dr)) because table.find returns the index of the value if it finds one. When you add the player into the array, you are doing table.insert(array, v.Name) which adds the players name, which doesn't match how you're removing them (you're using player object to remove instead of name). Should change it to table.insert(array, v) unless you have a different script to add the players.