Server script inside a part
local prompt = script.Parent.ProximityPrompt
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- RemoteEvent to tell the client to open the GUI
local openGuiEvent = ReplicatedStorage:WaitForChild("OpenSellShopGui")
prompt.Triggered:Connect(function(player)
openGuiEvent:FireClient(player)
end)
Local script inside a billboard gui inside a npc's torso
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = script.Parent
local openGuiEvent = ReplicatedStorage:WaitForChild("OpenSellShopGui")
openGuiEvent.OnClientEvent:Connect(function()
if gui.Enabled then
print("Sell shop is already opened")
else
gui.Enabled = true
end
end)
The gui is a billboard gui