Proximity prompt wont open ui

I am trying to make a proximity prompt that opens a shop ui, but it won’t work

this is a local script

local ui = game.StarterGui.Shop

script.Parent.Triggered:Connect(function()
	ui.Enabled = true
end)

donot reference ui in startergui instead reference them in PlayerGui

local player = game.Players.LocalPlayer
local ui = game.Players.LocalPlayer.PlayerGui

final script

local player = game.Players.LocalPlayer
local ui = player.PlayerGui.Shop

script.Parent.Triggered:Connect(function()
	ui.Enabled = true
end)

and if its a server script then do this

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

Still doesnt work

This is what the updated script looks like

local player = game.Players.LocalPlayer
local ui = player.PlayerGui:WaitForChild("Shop")

script.Parent.Triggered:Connect(function()
	ui.Enabled = true
end)

is it a server or client script? also did you get any errors?

It is a localscript
No errors

ignore this i have to put this here for some reason

is the local script in workspace?
if tho local scripts doesn’t run in workspace by default you will have to add a normal script and set RunContext to client

It is in the proximity prompt

I once again have to put this here for some reason

is the proximity prompt on workspace? local scripts donot run in workspace
if u want it to work in workpace add normal script
{21B91F92-E2E4-46A0-986E-B85F4135041C}
and set this to client
{4C438493-262B-4C01-B3F1-ACF97061B98C}

A proximity prompt does not even appear at all in the workspace, and no it is in a part

and the part is in workspace right? just tell me where you added it in workspace/replicatedstorage/etc…

i tested the script with screenGui named “Shop” and it worked fine

The proximity prompt is in a part, that is in a rig, that is in the workspace

YEAH so its in the workspace normal scripts in workspace are server scripts by default you will have to set the runcontext to “Client” so it will work
{3D350A28-D406-4CC6-81FE-E5EE7DB52CB1}

i dont see anything in the script called runcontext

because you added a local script remove it and add a “Script” but not “LocalScript”
{700A0CEE-9596-4FF9-A093-DE775C677E1B}

BUT donot add this one
{D06795CB-9DFB-47E8-8B11-3AC3CA30EA74}

i gtg