Proximity Prompt won't enable GUI

Hello, I’m trying to make a proximity prompt enable a gui once triggered. This is what I’ve tried:

local prompt = game.Workspace.PepeTheFrog.Pepe.ProximityPrompt
local player = game.Players.LocalPlayer
local pepegui = player.PlayerGui.PepeGUI
local playername = player.DisplayName
prompt.Triggered:Connect(function(opengate)
    
    pepegui.Enabled = true
            
end)

It is a local script within StarterCharacterScripts.

move it to server script service and see what it does

Try using WaitForChild
player:WaitForChild("PlayerGui"):WaitForChild("PepeGUI")

1 Like
local prompt = script.Parent
prompt.Triggered:Connect(function(player)
    local ui = player.PlayerGui.PepeGUI
    ui.Enabled = true
end)

Put this in a server script parented to the Prompt

1 Like

Fire from Server to Client too

As what others have said, use a Server Script instead, and make sure it’s parented to the ProximityPrompt. Now, as the Server cannot access the LocalPlayer, the code will need to change a bit.

Here is your updated code:

local prompt = script.Parent

prompt.Triggered:Connect(function(player)
    if player then -- checks to make sure player still exists
       local PepeGui = player:WaitForChild("PlayerGui"):WaitForChild("PepeGui")
       pepegui.Enabled = true
    end
end)
3 Likes