So basically, it works fine in studio but in-game it doesn't even work, the GUI buttons aren't responding at all, the Exit Button won't close the GUI, and the enter button won't activate.
plr = game.Players.LocalPlayer char = plr.Character script.Parent.Exit.MouseButton1Click:connect(function() script.Parent.Visible = false end) script.Parent.Enter.MouseButton1Click:connect(function() if script.Parent.PassBox.Text == "DarkZalSkull" then script.Parent.PassBox.Text = "Checking." wait(0.2) script.Parent.PassBox.Text = "Checking.." wait(0.2) script.Parent.PassBox.Text = "Checking..." wait(0.2) script.Parent.PassBox.Text = "Access Granted!" script.Parent.PassBox.TextColor3 = Color3.new(42, 213, 15) game.Workspace.PassDoor.Transparency = 1 game.Workspace.PassDoor.CanCollide = false wait(2) game.Workspace.PassDoor.CanCollide = true game.Workspace.PassDoor.Transparency = 0.2 script.Parent.Visible = false else script.Parent.PassBox.Text = "Checking." wait(0.2) script.Parent.PassBox.Text = "Checking.." wait(0.2) script.Parent.PassBox.Text = "Checking..." wait(0.2) script.Parent.PassBox.Text = "Access DENIED" char.Humanoid.MaxHealth = 0 char.Humanoid.Health = 0 end end)
Your issue is probably that you're not waiting for the GUI and Character to be fully loaded.
Try using
local char = plr.CharacterAdded:wait()
and
script.Parent:WaitForChild("Enter")
and
script.Parent:WaitForChild("Exit")
Another issue might be that you have FilteringEnabled turned on.