How to make my gui visible when the proxim triggered?

So, I’m working on a game I made, and I want to make a part if I press “E” it will bring out the GUI (ProximityPrompt)

And I typed some code in the part I want to add ProximityPrompt to, and I run the game, well there is no error at all in the output but the code doesn’t work, but strangely in the GUI Properties it is detected that the frame is visible

This is my code, looks simple, but please if there is an error please correct it

local SG = game:GetService("StarterGui")
local AP1 = SG.GameGUI.Appreciation1

script.Parent.Triggered:Connect(function()
	AP1.Visible = true
end)

You need to get the GameGui from the PlayerGui

Do this instead:

local Player = game.Players.LocalPlayer
local AP1 = Player.PlayerGui:WaitForChild("GameGUI").Appreciation1

script.Parent.Triggered:Connect(function()
	AP1.Visible = true
end)

It’s not working either, im so confused

make sure the script is a server script. And then do the following :

script.Parent.Triggered:Connect(function(Player)
   local UI = Player.PlayerGui:WaitForChild("GameGUI")
   if UI then
     UI.Enabled = true
     --if you want to make a frame/button visible, then access to that button/frame
     UI["BUTTON/FRAME'S NAME"].Visible = true
   end
end)

Wow thank you! I also just realized that there is an instance called PlayerGui

1 Like