Maybe I’m dumb or something, but I don’t even know where to start on this. This is my script so far
-- ss in sss
local PlayersLeft = game.ReplicatedStorage.Players -- intValue to show how many players left in numbers, I don't know how to display the name of the players
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local Humanoid = char.Humanoid
Humanoid.Died:Connect(function()
PlayersLeft.Value = PlayersLeft.Value -1
print(PlayersLeft.Value)
end)
end)
end)
game.ReplicatedStorage.RoundOver.Event:Connect(function()
local NumberOfText = PlayersLeft
for _, player in pairs(game.Players:GetPlayers()) do
player.PlayerGui.PlayersLeft.Enabled = true
repeat Instance.new("TextLabel", player.PlayerGui.PlayersLeft.Frame) until
#player.PlayerGui.PlayersLeft:GetChildren() == NumberOfText.Value
end
end)
Basically, I’m trying to figure out how to get the surviving players name, that’s all.
make a folder containing players and use this script:
local playerfolder = game.Workpsace.PlayersLeft
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
player.Character.Humanoid.Died:Connect(function()
if playerfolder:FindFirstChild(player.Name) then
playerfolder[player.Name]:Destroy()
end
end)
end
end)
game.ReplicatedStorage.RoundStarted.OnServerEvent:Connect(function(player)
for i,v in pairs(game.Players:GetChildren()) do
local playervalue = Instance.new("StringValue")
playervalue.Name = v.Name
end
end)