So, this is what I'm trying to make. I'm making a option where you click on the player to spectate them. It works fine, but my game uses camera manipulation, so the camera is fixed to the part until they choose their team. When you stop spectating a player it returns your camera to the normal camera. I need it to return the camera back to the part that I am using. I'm sorry the script is soo long, I've tried modifying parts of it, but I couldn't find what I need to change. Any help will be appreciated, thanks!
wait() while not script.GUI.Value do wait() end gui = script.GUI.Value playergui = gui.Parent player = playergui.Parent while not player:FindFirstChild("Backpack") do wait() end backpack = player.Backpack while not player.Character do wait() end wait() window = gui.Window frame = window.Frame function stopWatching() local cam = workspace.CurrentCamera cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom" watching = nil end function watch(plr) window.Visible = false if not plr.Character then return end local human = plr.Character.Humanoid if not human then return end local cam = workspace.CurrentCamera cam.CameraSubject = human cam.CameraType = "Custom" human.Died:connect(function () if watching == plr then wait(3) stopWatching() end end) watching = plr end player.Character.Humanoid.Died:connect(function () stopWatching() watch = function () end end) gui.Changed:connect(function (p) if p == "Parent" and not gui.Parent then stopWatching() end end) function update() if not window.Visible then return end frame:ClearAllChildren() local fw = window.Frame.AbsoluteSize.X - 10 local fh = window.Frame.AbsoluteSize.Y - 10 local bw = 100 local bh = 100 local cols = math.floor(fw / (bw + 10)) local rows = math.floor(fh / (bh + 10)) local players = game.Players:GetChildren() for k, v in pairs(players) do if v == player then table.remove(players, k) end end local n = 0 local col = 0 local row = 0 for i = 1, #players do local plr = players[i] local b = Instance.new("ImageButton", frame) b.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?username=" .. plr.Name b.Size = UDim2.new(0, bw, 0, bh) b.Position = UDim2.new(0, 5 + col * (bh + 10), 0, 5 + row * (bw + 10)) b.AutoButtonColor = true b.BackgroundColor3 = Color3.new(0, 0, 0) local l = Instance.new("TextLabel", b) l.Position = UDim2.new(0.5, 0, 0.5, 0) l.Text = plr.Name l.Font = "ArialBold" l.FontSize = "Size14" l.TextColor3 = Color3.new(1, 1, 1) if plr.Character:FindFirstChild("Survival") then l.TextColor3 = Color3.new(1, .8, .8) end l.TextStrokeColor3 = Color3.new(0, 0, 0) l.TextStrokeTransparency = 0 b.BorderColor3 = Color3.new(1, 1, 1) b.MouseButton1Down:connect(function () watch(plr) end) col = col + 1 if col > cols then col = 0; row = row + 1 end wait() end end window.Visible = false gui.TextButtonMain.MouseButton1Down:connect(function () if watching then stopWatching() else window.Visible = not window.Visible update() end end)