So I have a ScreenGui (in StarterGui of course) And it has 2 textbuttons. One called spec and one called Nextt. The first one is just the spectate button, the Nextt one is to switch players. Here's the spec script: (local)
local on = false local Players = game.Players:GetChildren() local PlayerSubject = Players[math.random(1, #Players)] local Camera = game.Workspace.CurrentCamera script.Parent.MouseButton1Down:connect(function() if on == false then Camera.CameraType = "Follow" Camera.CameraSubject = PlayerSubject.Character.Humanoid script.Parent.Parent.Nextt.Visible = true script.Parent.Text = "Close" on = true end if on == true then script.Parent.Parent.Nextt.Visible = false script.Parent.Text = "Spectate" on = false end end)
And here's the nexxt button's script:
script.Parent.MouseButton1Down:connect(function() local Players = game.Players:GetChildren() local PlayerSubject = Players[math.random(1, #Players)] local Camera = game.Workspace.CurrentCamera Camera.CameraType = "Follow" Camera.CameraSubject = PlayerSubject.Character.Humanoid end)
It doesn't work though, I started a server, and two players, and completely no output, whatsoever. Will this only work in-game or what?
I think the problem is is that when the CameraSubject is a Humanoid, you can only use the 'Custom' CameraType. Try that then post back :)