My script (for a SurfaceGUI) randomly stops working

I’m trying to replicate the game selection monitor from Five Nights at Freddy’s Help Wanted but the actual SurfaceGUI used to select the games randomly stops working completely. Like it’s completely random if it works or doesn’t work and I have no idea why.

It only randomly doesn’t work whenever I load into the game, it either works or doesn’t work and it seems to be based upon that issue. This has been happening way before I scripted any other parts of the game so it may not be other scripts.

The script is server-sided because LocalScripts seem to not work at all.

I’ve checked through the whole code, nothing seems to be wrong with it.

gameButtons = script.Parent.Screen.GameButtons.Frame

nightButtons = script.Parent.Screen.NightButtons.Frame

local currentGame = “”

gameButtons.FNAF1.MouseButton1Click:Connect(function(player)

print(“fnaf 1”)

currentGame = “FNAF1”

end)