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

i need a textbook to open up when a player clicks a textbutton?

Asked by
Or2no 30
5 years ago

My intermission will be a textbox that opens up when a player hits a textbutton. Unfortunately, my intermission bar just stays hidden even after I click.

local button = script.Parent
local intermission = game.StarterGui.intermission.TextBox
    intermission.Visible = false

local function close(click) 
    local title = script.Parent.Parent.Title
    local description = script.Parent.Parent.TextBox
    local click = script.Parent.MouseButton1Click
    if button and click then
        title:Destroy()
        description:Destroy()
        button:Destroy()
        game.StarterGui.Greeting:Destroy()
        intermission.Visible = true
    end
end


button.MouseButton1Click:Connect(close)

P.S. I want to make a GUI similar to Natural Disaster Survival, I may have more questions coming soon.

1 answer

Log in to vote
0
Answered by
IDKBlox 349 Moderation Voter
5 years ago
Edited 5 years ago

You're issue is you're trying to get the StarterGui's Gui, Therefor, that's why it's not erroring; Because technically it is working. Just not for the PlayerGui

If you're wanting to get a playerGui while the game is active you need to use playergui

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')

local intermission = PlayerGui:WaitForChild('intermission').TextBox

Ad

Answer this question