Basically, there is a table (called plrs) that stores every player’s name in it. Every player has three lives and when they reach zero then they die and gets removed from the table. I have tried various methods but each time it does not work. Can somebody please help me and pick out any mistakes I did? Thank you for reading
Here’s the scripts (I know it’s a bit messy sorry about that)
Server Script (called Stats):
game:GetService("ReplicatedStorage"):WaitForChild("ActuallyDead").OnServerEvent:Connect(function()
if GamesStart.Value == true then
if character:FindFirstChild("GameTag") then
character.GameTag:Destroy()
end
player.Team = game.Teams["Not Playing"]
wait(2)
game.ReplicatedStorage:WaitForChild("SpectateShow"):FireClient(player, true)
game.ReplicatedStorage:WaitForChild("EquippedShow"):FireClient(player, true)
game.ReplicatedStorage:WaitForChild("Lives"):FireClient(player, false)
game.ReplicatedStorage:WaitForChild("LivesButThisTimeItWillWok"):FireClient(player, player)
end
end)
Don’t bother with the other code, just focus on “LivesButThisTimeItWillWok” remote event (strange name I know)
Local script (called “Lives”):
game:GetService("ReplicatedStorage"):WaitForChild("LivesButThisTimeItWillWok").OnClientEvent:Connect(function(player)
game:GetService("ReplicatedStorage"):WaitForChild("tablePlrs"):FireServer(player)
end)
Server script (called “MainScript”):
game:GetService("ReplicatedStorage").tablePlrs.OnServerEvent:Connect(function(player)
table.remove(plrs, player)
end)
thank you for reading.