I am trying to get it when the user is done holding the button, the GUI shows.
local service = game:GetService("ProximityPromptService")
function showDialog(player)
if player then
local label = game.StarterGui.MetaverseGUI.TextLabel
label.Visible = true
end
end
service.PromptTriggered:Connect(showDialog)
Use PlayerGui instead of StarterGui and your not specify what proximity prompt is triggered.
Here is an example with a Script:
script.Parent.ProximityPrompt.Triggered:Connect(function(Player)
local Gui = Player:FindFirstChild("PlayerGui")
if Gui ~= nil then
local MetaverseGUI = Gui:FindFirstChild("MetaverseGUI")
if MetaverseGUI ~= nil then
MetaverseGUI.TextLabel.Visible = true
end
end
end)
You never really specified where you’re triggering the prompt like @Crygen54 mentioned earlier, the first parameter of the PromptTriggered event is the actual Prompt Instance, then the Player And you hath get the StarterGui instead of the PlayerGui, which is replicated across the server-side only
local service = game:GetService("ProximityPromptService")
local function showDialog(PromptInstance, Player)
if Player then
local label = Player.PlayerGui:FindFirstChild("MetaverseGUI")
if label then
label.TextLabel.Visible = false
end
end
end
service.PromptTriggered:Connect(showDialog)