Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

the Password Door GUI script isn't working?

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)

4 comments

0

I recommend using the Output feature as the studio, as it may help you w/ your problem (it returns feedback). :) From the looks of your script, it may be that "Exit," or the script's parent, as well as other children, may not exist at the time of execution; I recommend using the WaitForChild function to counter this: http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild

0

I don't think it's that... the GUI is already in StarterGui or PlayerGui, it's loaded already?

0

Are there any errors in the output via the developer's console in-game when you try to click a button?

0

Is this a server script or a local script?

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.