New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Can some someone explain to me how to make an onTouch event for a ScreenGUI to pop up when touched?

Asked by 8 days ago
Edited 8 days ago

I am trying to make a onTouch event, but the only line I can remember is:

onTouch

When the part is touched??? Can I have some help please???

0
No, when you touch it with your character. goodlead 21 — 8d

1 answer

Log in to vote
0
Answered by 8 days ago
Edited 8 days ago

So screen GUIs hold frames or buttons. A screen GUI is just what gets the button onto the screen.

Let’s say I put ScreenGui into StarterGui and put a frame inside it called frame. Set the frames visibility to false.

Then I put a part in workspace called part.

You can put this in a local script inside starterGui, characterscripts or playerscripts.

local player = game.Players.LocalPlayer
local part = game.Workspace.part

part.Touched:Connect(function(hit) 
     player.PlayerGui.ScreenGui.frame.Visible = true

end)

Or you could put it in a script (not a localscript)inside the part:

local part = script.Parent

part.Touched:Connect(function(hit) 
     local player = GetPlayerFromCharacter(hit.Parent)
     player.PlayerGui.ScreenGui.frame.Visible = true
end)
0
Can you make like gamepass in that? iivSnooxy 41 — 8d
0
You also could set the ScreenGui.Enabled to false and then set it to true in the function instead of saying.Visible SethHeinzman 268 — 8d
0
Yes that does not look bad but i would check if its actually a player who is touching esepek 5 — 8d
0
Thanks seth for all your help!!! goodlead 21 — 8d
View all comments (2 more)
0
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then end end end) esepek 5 — 8d
0
I have also accepted your answer!!! I would up-vote if I had 25+ Reputation!!! goodlead 21 — 8d
Ad

Answer this question