How to disable script outside of Lobby? (repost)
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! :)
04 | local player = game.Players.LocalPlayer |
07 | if player.Lobby then player.PlayerGui.SpectateGui = true |
08 | else player.PlayerGui.SpectateGui = false |
14 | script.Parent.Next.MouseButton 1 Click:connect( function (right) |
15 | players = game.Players:GetChildren() |
17 | if players [ number ] ~ = nil then |
18 | game.Workspace.CurrentCamera.CameraSubject = players [ number ] .Character.Humanoid |
19 | if players [ number ] .Name ~ = player.Name then |
20 | script.Parent.PlayerName.Text = players [ number ] .Name |
22 | script.Parent.PlayerName.Text = "Nobody" |
24 | elseif players [ number ] = = nil then |
26 | game.Workspace.CurrentCamera.CameraSubject = players [ number ] .Character.Humanoid |
27 | if players [ number ] .Name ~ = player.Name then |
28 | script.Parent.PlayerName.Text = players [ number ] .Name |
30 | script.Parent.PlayerName.Text = "Nobody" |
35 | script.Parent.Previous.MouseButton 1 Click:connect( function (left) |
36 | players = game.Players:GetChildren() |
39 | if players [ number ] ~ = nil then |
40 | game.Workspace.CurrentCamera.CameraSubject = players [ number ] .Character.Humanoid |
41 | if players [ number ] .Name ~ = player.Name then |
42 | script.Parent.PlayerName.Text = players [ number ] .Name |
44 | script.Parent.PlayerName.Text = "Nobody" |
46 | elseif players [ number ] = = nil then |
48 | game.Workspace.CurrentCamera.CameraSubject = players [ number ] .Character.Humanoid |
49 | if players [ number ] .Name ~ = player.Name then |
50 | script.Parent.PlayerName.Text = players [ number ] .Name |
52 | script.Parent.PlayerName.Text = "Nobody" |
57 | script.Parent.Parent.SpectateButton.Spectate.MouseButton 1 Down:connect( function (click) |
58 | if script.Parent.Parent.Active.Value = = false then |
59 | script.Parent.Parent.Active.Value = true |
60 | script.Parent.Parent.ChangePlayer.Visible = true |
61 | elseif script.Parent.Parent.Active.Value = = true then |
62 | script.Parent.Parent.Active.Value = false |
63 | script.Parent.Parent.ChangePlayer.Visible = false |
64 | script.Parent.PlayerName.Text = "Nobody" |
66 | game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid |