local L=script.Parent.OpenSpectate local m=script.Parent.Frame local i=m.PlrName local M=m.Left local N=m.Right local T=workspace.CurrentCamera local x=1 local f=game.Players.LocalPlayer L.MouseButton1Click:Connect(function()if m.Visible==true then m.Visible=false i.Text=f.Name T.CameraSubject=f.Character.Humanoid x=1 else m.Visible=true i.Text=f.Name T.CameraSubject=f.Character.Humanoid x=1 end end)N.MouseButton1Click:Connect(function()local L=game.Players:GetPlayers()local m=#L x=x+1 if x>m then x=1 end T.CameraSubject=L[x].Character.Humanoid i.Text=L[x].Name end)M.MouseButton1Click:Connect(function()local L=game.Players:GetPlayers()local m=#L x=x-1 if x<1 then x=m end T.CameraSubject=L[x].Character.Humanoid i.Text=L[x].Name end)

local button = script.Parent.OpenSpectate
local frame = script.Parent.Frame
local title = frame.PlrName
local left = frame.Left
local right = frame.Right
local cam = workspace.CurrentCamera
local num = 1
local plr = game.Players.LocalPlayer

button.MouseButton1Click:Connect(function()
	if frame.Visible == true then
		frame.Visible = false
		title.Text = plr.Name
		cam.CameraSubject = plr.Character.Humanoid
		num = 1
	else
		frame.Visible = true
		title.Text = plr.Name
		cam.CameraSubject = plr.Character.Humanoid
		num = 1
	end
end)

right.MouseButton1Click:Connect(function()
	local players = game.Players:GetPlayers()
	local all = #players
	num = num +1
	if num > all then
		num = 1
	end
	cam.CameraSubject = players[num].Character.Humanoid
	title.Text = players[num].Name
end)

left.MouseButton1Click:Connect(function()
	local players = game.Players:GetPlayers()
	local all = #players
	num = num -1
	if num < 1 then
		num = all
	end
	cam.CameraSubject = players[num].Character.Humanoid
	title.Text = players[num].Name
end)
