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.
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)