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

I'm making a story game and trying to make a text box go away, but it won't?

It's basically like a box with a picture and text for like a story game, but it won't go away. What do I need to change here?

game.StarterGui.ScreenGui.Frame.Visible = false

3 answers

StarterGui replicates whatever is inside it to the character when the character spawns. The player has a seperate folder inside of it that is called PlayerGui. This is where gui's that the player currently has are stored, and where you need to be editing. You can access PlayerGui by accessing the player.

local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame

However, if you place a script inside of StarterGui , it will also be replicated to the player, and can modify the gui's inside PlayerGui by simply doing script.Parent

-- Local script inside StarterGui
local gui = script.Parent.ScreenGui.Frame

--This works no matter where in startergui it is. Place it inside the fram
e you want to turn invisible
local gui = script.Parent

https://developer.roblox.com/en-us/articles/Creating-GUI-Buttons https://developer.roblox.com/en-us/api-reference/class/Frame Some examples

--Inside StarterGui
local gui = script.Parent.ScreenGui.Frame

--Make gui invisible
gui.Visible = false
--Make it visible
gui.Visible = true

--Change gui size
gui.Size = Vector3.new(1,0,1,0)

--Move gui using TweenService (Tween service is a handly feature that will move the part slowly depending on the speed, instead of instantly)
gui:TweenPosition(UDim2.new(.5,0,.5,0),"Out","Quad",.25,true)

--Resize gui using TweenService
gui:TweenSize(UDim2.new(.5,0,.5,0),"Out","Quad",.25,true)

If you want to learn more about tweening and animating Gui's go here https://developer.roblox.com/en-us/articles/GUI-Animations

5 comments

0

It's not working but I'm not sure if I'm doing everything right. I put the local gui = script.Parent as a local script in the frame, but that's all I wrote. Am I supposed to write anything else?

0

Oh yeah, I'm sorry alls I was doing was defining the gui itself. You had it right to begin with, however you were trying to edit the wrong gui. If you define it like you did, you can then on another line do something like, gui.Visible = false, gui.Size = UDim2.new(1,0,1,0), etc. I recommend looking at some of the links i'll post to learn some more about it. Gui's are quite simple after using them

0

I edited my post to contain 2 links, one is a tutorial to make some buttons, it mainly references changing the image of it in and detecting clicks in the codes, but you can apply that knowledge and use the second link to learn all the properties of them.

0

Thanks, but it still won't work. I put this script in a local script in the frame: local gui = script.Parent gui.Visible = false After, I put it in my game script to go away but that's where it won't work. Here is the game script: local function challenge_intro() local Gerald_Image = "rbxassetid://6004984417" CreateDialogueEvent:FireAllClients(Gerald_Image, "Ugh, what happened?") wait(2) game.

0
  • game.Startergui.talkPoof.Disabled=false --this is the line with the script.

This line of code is changing StarterGui, which is the gui each player gets their gui from when they respawn/join.

If you are doing this locally (the player clicks a button, and then it moves on) then put this line into a local script:

game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false

If you're doing this server-ended (after a certain amount of time, the it goes off of everyone's screen), put this into a server script:

local players = game.Players:GetChildren()
for i,_ in pairs(players) do
	i.PlayerGui.ScreenGui.Frame.Visible = false
end

3 comments

0

Nevermind, it doesn't work.

0

The output says Workspace.poofScript:3: attempt to index number with 'PlayerGui'

0

sorry for the delay. Fix the script by changing i.PlayerGui.ScreenGui... to _.PlayerGui.ScreenGui

You need to put this game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false not game.StarterGui.ScreenGui.Frame.Visible = false

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