Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Spectate Gui, No i'm not asking for it, just help me fix mine?

Asked by 10 years ago

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?

0
Both scripts are local* systematicaddict 295 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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 :)

0
That worked fine, but in my game the players lock first person during the round, so when I spectate another player, how can I make it so they can zoom in and out because you can't close spectate like that. systematicaddict 295 — 10y
0
Sorry, I don't know if that's possible. YaYaBinks3 110 — 10y
Ad

Answer this question