[SOLVED] Pop-up GUI whilst touching brick?
Asked by
8 years ago Edited 8 years ago
I am having trouble making a GUI pop up when the player is touching a part, but then the GUI disappears when the player is not touching the part.
The part that I want the player to touch and activate the GUI is called 'Part'.
The GUI is called 'GUI'.
The tree goes like this, Workspace > Part > Script > GUI
This is the code I have so far:
01 | script.Parent.Touched:connect( function (char) |
02 | local player = game.Players:GetPlayerFromCharacter(char) |
03 | if player and not player.PlayerGui.GUI then |
04 | script.GUI:clone().Parent = player.PlayerGui |
08 | script.Parent.TouchEnded:connect( function (char) |
09 | local player = game.Players:GetPlayerFromCharacter(char) |
10 | if player and player.PlayerGui.GUI then |
11 | player.PlayerGui.GUI:Destroy() |
When I test, the GUI just doesn't come up on screen when I touch the part.
How do I fix this??