How to make proximityprompt show Gui?

I have searched for so long and I have found many ways to make a Gui pop up but when I test them they show up just once then they don’t show ever again there are no errors when I try to print a message the message shows but still it the Gui doesn’t pop up WHY?!?!?

Here is the script that I use:
script.Parent.Triggered:Connect(function(Player)
local PGui = Player.PlayerGui
PGui.ScreenGui.Frame.Visible = true
end)

1 Like

Try this -

script.Parent.Triggered:Connect(function(Player)
   Player.PlayerGui:WaitForChild("MyGui").Frame.Visible = true
end)

If that doesnt work, check this out :

[If you follow that post’s solution, you’ll notice that you need a local script]

[If you want to use remotes, it’s a better way, simply do this:]

--Server

script.Parent.Triggered:Connect(function(Player)
   game:GetService("ReplicatedStorage").ShowGuiRemote:FireClient(Player)
end)

--Client

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

game:GetService("ReplicatedStorage"):WaitForChild("ShowGuiRemote").OnClientEvent:Connect(function()
   Player:WaitForChild("PlayerGui").MyGui.Frame.Visible = true
   --OR, if you simply have 'MyGui' close to that localscript, do something:
   --Here, I assume you have that local script inside your MyGui 
   script.Parent.Frame.Visible = true
end)


Also when using prints instead of just printing something like print("this works") try something more in-depth like print(Player) to see if the player shows up each time.

An example from a old script i have

local ProximityPromptService = game:GetService("ProximityPromptService")

local ProximityPrompt = workspace.QuestNPC.Humanoid:WaitForChild("Prox")
local QuestGui = lclplr.PlayerGui.QuestGui.Frame

ProximityPromptService.PromptTriggered:Connect(function(plr)
	QuestGui.Visible = not QuestGui.Visible
	ProximityPrompt.Enabled = false
end)

This makes no sense, why would you suggest someone to do a wrong method?, you cannot really keep a local script in server-side objects, it won’t work, and you cannot look into a player gui from a server-sided script

Neither way is recommended either possible for doing this, the only way is a remote event/function

You should learn it quite a bit before performing things such as these, as at starting this might be confusing, but thats based on concept of server/client sides

In these things like doing on server, you should always do a remote event for one side communicatio

I didnt say that.
I mentioned the local script referred to the linked post.

That’s always preferred. But if the UI isn’t big / messy, there’s no big deal with accessing it simply by that.

So you’re going to put remote for even stepping on a brick to open a shop? ridiculous, there is no need in doing so.

How would you do then? you would keep a script in brick, and it does it? Like what your trying to say, remote events are the most basic formes of it, even in DevHub its written that its also used for shop ui as example

Yes, using remotes for shop UIs is obviously necessary. But not for opening the UI itself. [Depends if you want only 1 client to see it, etc, etc.]

Ok, I found a solution and it works somehow.

2 Likes