local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local focusPart = game.Workspace.FocusPart
script.Parent.MouseButton1Click:Connect(function()
if _G.ongoing == false then
cam.CameraType = Enum.CameraType.Custom
cam.CameraSubject = player.Character.Humanoid
elseif _G.ongoing == true then
print("Round ongoing")
script.Parent.Parent.Parent.Status.Visible = true
script.Parent.Parent.Parent.Status.Text = "There is currently a game ongoing! Please wait until a new round starts."
end
end)
I am trying to make it so when a player clicks a button, if a round is not ongoing, their camera gets reset. Otherwise, make a status message pop up. I am not getting any errors in the output. Any help? The _G variable is declared inside a server script.
That’s your issue then, nil will become false in an if statement, hence why it doesn’t work. Instead of using .G, I would reocmmend making a BoolValue to contain if the game is ongoing or not and make it reference that instead. Make sure you make the BoolValue change from the Server and not client, otherwise you’d have another issue haha