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

How do I make a textbutton that appears after x time?

Asked by 6 years ago

I want to make a textbutton for my gui that is invisible and after x seconds it makes visible.

I try making a script like this:


wait(3)

game.StarterGUI.ScreenGUI.Frame.TextButton.Visible = tick

but it doesn't work. Please could you help me?

2 answers

Log in to vote
0
Answered by
Troidit 253 Moderation Voter
6 years ago
Edited 6 years ago

First thing I notice is that you're calling StarterGui. Changing things in StarterGui during the game won't affect the player's Gui.

So how do we change the player's Gui? The answer is simple. Inside a local script, we need to first find the player.

--inside a local script
local Player = game.Players.LocalPlayer --Getting the local player from the service Players.

Then we simply locate the Gui from Player and change the property.

--inside a local script
local Player = game.Players.LocalPlayer --Getting the local player from the service Players.

Player.PlayerGui.ScreenGUI.Frame.TextButton.Visible = false

So here's the finished product.

--inside a local script
local Player = game.Players.LocalPlayer --Getting the local player from the service Players.

wait(3)

Player.PlayerGui.ScreenGUI.Frame.TextButton.Visible = false

EDIT An easier solution would be making a local script just inside the TextButton and writing this:

--inside a local script
local button = script.Parent
wait(3)
button.Visible = false

Remember that since the Gui is in StarterGui, it'll already be replicated to the PlayerGui for you.

0
Where do I create the local script FrikiGameplaysHD 1 — 6y
0
Actually there's an even easier solution. I'll rewrite an edit. Troidit 253 — 6y
0
Ok FrikiGameplaysHD 1 — 6y
0
THANK YOU IT WORKED!!!!!!!!!!!!!!! FrikiGameplaysHD 1 — 6y
0
Don't forget to mark answered :) Troidit 253 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

I think your code should work to be honest..

local gui = *Your Gui Path*
wait(3)
gui.Visible = true

The above code should work but maybe another setting is disabled. For instance, the Enabled property.

My solution would be to instead of making it visible, cloning it from ReplicatedStorage or ReplicatedFirst(whatever fits your needs more), and then destroying the gui when you are done with it. It is much easier because no settings have to be changed, literally just:

local gui = *Your Gui Path*
local player = game:GetService("Players").LocalPlayer

wait(3)

local clone = gui:Clone()
clone.Parent = player.PlayerGui

wait(3)

clone:Destroy()

Of course, you don't need to wait to destroy, you could make a button when pressed do that. Sorry if the code is wrong, I just wrote it really fast. You make the decision which is better for you, and I hoped I helped!

Edit: OH, you also forgot to add brackets to the tick

0
Thanks, i'll try it FrikiGameplaysHD 1 — 6y
0
Alright. Make sure if you use the method I mentioned everything is enabled like Visible, or else it will not show. DatOneRandomDude 69 — 6y
0
I don't know how to do it, have you got discord ot skype? FrikiGameplaysHD 1 — 6y
0
Sorry, no. But just make sure Enabled is true and Visible is true, then when you clone it it is visible. As,e for your script, make sure Enables is true too. DatOneRandomDude 69 — 6y
0
I solved it, but thanks anyways FrikiGameplaysHD 1 — 6y

Answer this question