Hello!
I am re-posting this question, as there was no suggestions for my last question. I've tried additional methods in the days since, but have not had any success. Any help would be very much appreciated. :)
I have a Spectate mode script that works, everywhere, but I'd like it to only work while inside the Lobby.
Currently, I have the "ResetOnSpawn" box checked so that when a player dies in the game, the Spectate Mode is reset when they reappear in the Lobby, but if the player has it turned on while in the Lobby, when they teleport to the Game Map, Spectate Mode is still on.
Is there an easy way to do it? I know the code below is horribly wrong, but its where I've started. Any suggestions is appreciated. Thank you! :)
local players = nil
local number = 1
local maxnumber = 0
local player = game.Players.LocalPlayer
-- Broken Script Below
if player.Lobby then player.PlayerGui.SpectateGui = true
else player.PlayerGui.SpectateGui = false
end
-- Broken Script Above
script.Parent.Next.MouseButton1Click:connect(function(right)
players = game.Players:GetChildren()
number = number + 1
if players[number] ~= nil then
game.Workspace.CurrentCamera.CameraSubject = players[number].Character.Humanoid
if players[number].Name ~= player.Name then
script.Parent.PlayerName.Text = players[number].Name
else
script.Parent.PlayerName.Text = "Nobody"
end
elseif players[number] == nil then
number = 1
game.Workspace.CurrentCamera.CameraSubject = players[number].Character.Humanoid
if players[number].Name ~= player.Name then
script.Parent.PlayerName.Text = players[number].Name
else
script.Parent.PlayerName.Text = "Nobody"
end
end
end)
script.Parent.Previous.MouseButton1Click:connect(function(left)
players = game.Players:GetChildren()
maxnumber = #players
number = number - 1
if players[number] ~= nil then
game.Workspace.CurrentCamera.CameraSubject = players[number].Character.Humanoid
if players[number].Name ~= player.Name then
script.Parent.PlayerName.Text = players[number].Name
else
script.Parent.PlayerName.Text = "Nobody"
end
elseif players[number] == nil then
number = maxnumber
game.Workspace.CurrentCamera.CameraSubject = players[number].Character.Humanoid
if players[number].Name ~= player.Name then
script.Parent.PlayerName.Text = players[number].Name
else
script.Parent.PlayerName.Text = "Nobody"
end
end
end)
script.Parent.Parent.SpectateButton.Spectate.MouseButton1Down:connect(function(click)
if script.Parent.Parent.Active.Value == false then
script.Parent.Parent.Active.Value = true
script.Parent.Parent.ChangePlayer.Visible = true
elseif script.Parent.Parent.Active.Value == true then
script.Parent.Parent.Active.Value = false
script.Parent.Parent.ChangePlayer.Visible = false
script.Parent.PlayerName.Text = "Nobody"
number = 1
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end
end)

1 comment
er...I'm pretty sure I broke my script. :D... local players = nil local number = 1 local maxnumber = 0 local player = game.Players.LocalPlayer local lobby = workspace:WaitForChild('Lobby') script.Parent = false while true do player.lobby = true end script.Parent = false if script.Parent == true then spectate script here else script.Parent = false end