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

How do I make a popup gui by touching a brick?

Asked by 5 years ago

I want to make a GUI popup when a player touches a specific brick.

I'm finding a lot of trouble with the positioning of the GUI frames but that is not what I need help with. When the player touches the brick, a text will popup on the screen for (3) seconds, and then disappear.

I remember trying to do this without help but did not succeed and the GUI just doesn't pop up, I removed the script shortly after because I could not find the reason why it did not work so I can't paste it in here.

The player is not allowed to skip the text and will have to wait for the GUI to disappear in the (3) seconds.

I hope that my explanation is clear enough and that I am not confusing anyone, just in case more explanation is needed, please use the comments section and I'll try to answer as fast as possible! Any help is very appreciated.

2 answers

Log in to vote
0
Answered by
BashGuy10 384 Moderation Voter
5 years ago
Edited 5 years ago

(insert something funny here)

hi lemme help

You want to use remote events.

To start of, create a RemoteEvent in ReplicatedStorage, make sure to name it: "PopupGuiEvent"

Now lets get into scripting it!

First of, inside the part, make a server script and insert the following code into it!

If this helped you, please mark this as the answer!

Server Script

local event = game:GetService("ReplicatedStorage"):WaitForChild("PopupGuiEvent")

script.Parent.Touched:Connect(function(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

    if plr then
        event:FireClient(plr)
    end
end)

Now make a local script inside StarterGui, and then insert the following code into it.

Local Script

local event = game:GetService("ReplicatedStorage"):WaitForChild("PopupGuiEvent")
local gui = script.Parent.PopupGui.Frame
local db = false


event.OnClientEvent:Connect(function()
    if not db then -- If db is false, the script will run the next bits of code
        gui.Visible = true
        db = true

        wait(3)

        gui.Visible = false
        db = false
    end
end)
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
View all comments (9 more)
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
testing if i fixed a problem with my scriptinghelpers page BashGuy10 384 — 5y
0
Hey, this did not work for me and I'm not sure if I did it right. I am so thankful for using your time, to make a script for me aswell, I'm not sure if I got this part right though, should I name the Frame or the Screengui that has the frame in it? oliwierpl11alt 20 — 5y
0
Name the screengui  "PopupGui", im about to edit the script to work. BashGuy10 384 — 5y
0
Thanks oliwierpl11alt 20 — 5y
Ad
Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

You can do this either two ways: Both ways require you to use a bricks touch event. Mind the lack of code. I'm on my phone so I can't write well. Second method is more complicated but it's good for doing more advanced things to the gui.

Method #1

1) Create a touch event that does the following: 2) get the players gui inside the player

(Not sure where it is off the top of my head but you can see it's location when you press play and look at the players in the explorer.)

3) Next, change the guis visible property to true

4) Wait(3)

5) Make the gui's visible to false.

Method #2

1) Create a touch event that does the following:

2) Fire a remote event called showGui

3) In a local script inside the gui, have a function that runs when the remote event is fired:

4) Inside the function make the gui visible

5) Wait(3)

6) Make it invisible again

0
OOF, i just posted a answer lol BashGuy10 384 — 5y
0
OOF, i just posted a answer lol BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
View all comments (17 more)
0
uhh, why are there two comments BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
0
uhh, why are there two comments BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
HELP BashGuy10 384 — 5y
0
It's gucci u have code so that's nicer I can't get on my computer to write code sadly. royaltoe 5144 — 5y
0
HELP BashGuy10 384 — 5y
0
Wtf royaltoe 5144 — 5y
0
what is happening BashGuy10 384 — 5y
0
/shrug royaltoe 5144 — 5y

Answer this question