Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

the Password Door GUI script isn't working?

Asked by 7 years ago

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)
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 TheeDeathCaster 2368 — 7y
0
I don't think it's that... the GUI is already in StarterGui or PlayerGui, it's loaded already? HornedWyven 10 — 7y
0
Are there any errors in the output via the developer's console in-game when you try to click a button? VinnyTheButcher 278 — 7y
0
Is this a server script or a local script? Pyrondon 2089 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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.

Ad

Answer this question