I want to make a musical chairs system, and kill the player who does not get a seat.
However, there’s a weird problem. When testing it with multiple clients, if “Player1” sits down, he is killed even though he has sat down and is in the table, but when “Player2” sits down, he is not killed.
There’s been nothing that I’ve found that has helped me.
Code:
local function selectSeats(chair, otherPart)
print(otherPart)
local character = otherPart
local player = Plrs:GetPlayerFromCharacter(character)
if player and not seatedPlayers[player] then
table.insert(seatedPlayers,player)
print(player.Name .. " has taken a seat")
player.Character.HumanoidRootPart.Anchored = true
print(#seatedPlayers .. " players are seated")
if #seatedPlayers == #Plrs:GetPlayers() - 1 then
for _, p in ipairs(Plrs:GetPlayers()) do
if not seatedPlayers[p] then
print(p.Name .. " is eliminated")
p.Character.Humanoid.Health = 0
break
end
end
end
end
end
I provided a snippet of my code which should be enough. Any help appreciated!