Hi I've watched this youtube tutorial
I have a team in my game, which is lobby and playing, so I just want to spectate to the playing team not all players, is there a way?
Hi I've watched this youtube tutorial
I have a team in my game, which is lobby and playing, so I just want to spectate to the playing team not all players, is there a way?
This is from the script provided from the video you sent:
local frame = script.Parent
local open = frame.Parent.Open
local close = frame.Parent.Close
local specLabel = frame.Parent.SpecLabel
local player = game.Players.LocalPlayer
frame.Visible = false
close.Visible = false
specLabel.Visible = false
local function spec()
frame.Visible = not frame.Visible
for _, button in pairs(frame:GetChildren()) do
if button:IsA('TextButton') then
button:Destroy()
end
end
for _, plr in pairs(game.Teams["Playing"]:GetPlayers()) do -- This is the part that needs change
if plr.Name ~= player.Name then
local name = Instance.new('TextButton')
name.Parent = frame
name.Text = plr.Name
name.TextScaled = true
name.MouseButton1Click:Connect(function()
local person = game.Players:FindFirstChild(name.Text)
game.Workspace.CurrentCamera.CameraSubject = person.Character
specLabel.Visible = true
specLabel.Text = 'Spectating '..name.Text
frame.Visible = false
close.Visible = true
end)
end
end
end
close.MouseButton1Click:Connect(function()
game.Workspace.CurrentCamera.CameraSubject = player.Character
specLabel.Visible = false
close.Visible = false
end)
open.MouseButton1Click:Connect(spec)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can make a table. Then loop through all the players in the playing team and put those players in that table. Then once you are spectating then you should spectate from the table which only consists of the players who are in the playing team.