Script to show a GUI

What do you want to achieve?
I am trying to make it, so after the proximity prompt is triggered, a GUI pops up.

What is the issue?
The GUI wont show.

Script Photo:
image

What solutions have you tried so far?
I have asked friends, and went through old scripts, it was no use.

The script is a local script. The GUI is obviously in StarterGui. I am not a great scripter, so I am not sure what to do. Thank you everyone!

its because you are disabling the script on line 13. If you are trying to add debounce, use classic function instead of anonymous
Try this instead:

local debounce = false

local function showGUI()
     if debounce == false then --checks for debounce
          debounce = true --enables the debounce
          ScreenGUI.Enabled = true
          task.wait(0.01)
          textLabel.Visible = true
          voiceLine:Play()
          task.wait(5)
          textLabel.Visible = false
          ScreenGUI.Enabled = false
          debounce = false --sets the debounce to false
     end
end

model.ProximityPrompt.Triggered:Connect(showGUI) --connects the function into event
1 Like

Also you need to have the local script in starterGUI too, local script cannot run in workspace

Do I have to use a Remote Event then, to connect them?

Actually you don’t, just define the proximity prompt from the local script! Like this:

Local proximityPrompt = workspace:WaitForChild("proximityPrompt") 

And connect it in the client script to the function