Hello, this spectate function doesn’t open the spectate ui during any point of the game even when the status isn’t set to intermission. I’d also like to know how I could remove players that are in the lobby from the playerlist table. Any help is appreciated.
SpectateButton.Activated:Connect(function()
local Player = Players.LocalPlayer
local Humanoid = Player.Character.Humanoid
if #Players:GetPlayers() == 1 then return end
if Player.Status.Value ~= "Lobby" then return end
if RoundInfo.Status.Value == "Intermission" then return end
if Spectate.Visible == false then
Spectate.Visible = true
else
Spectate.Visible = false
PlayerName.Text = "Spectating Nobody"
Camera.CameraSubject = Humanoid
end
end)
NextPlayer.Activated:Connect(function()
local PlayerList = Players:GetPlayers()
table.remove(PlayerList, table.find(PlayerList, Players.LocalPlayer))
local Player = PlayerList[Position + 1]
local Humanoid = Player.Character.Humanoid
if Humanoid then
Position = (Position + 1) % #PlayerList
Camera.CameraSubject = Humanoid
PlayerName.Text = "Spectating "..Player.Name
end
end)