0 views0 copies0 likes

NPC Dialogue Panel from Interaction Prompts

Universal script

Copy it, then test it in your own Studio place.

UI systems Verified

Script code

17 lines ยท 0.7 KB
Download
local player = game:GetService("Players").LocalPlayerlocal prompts = game:GetService("ProximityPromptService")local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))gui.ResetOnSpawn = falselocal panel = Instance.new("TextButton", gui)panel.AnchorPoint = Vector2.new(0.5, 1)panel.Position = UDim2.fromScale(0.5, 0.88)panel.Size = UDim2.new(0.82, 0, 0, 105)panel.TextWrapped, panel.Visible = true, falsepanel.TextSize = 20panel.Activated:Connect(function() panel.Visible = false end)prompts.PromptTriggered:Connect(function(prompt, who)	local text = prompt:GetAttribute("DialogueText")	if who ~= player or typeof(text) ~= "string" then return end-- โ€ฆopen Get script for the full source

About this script

Place a ProximityPrompt on your shopkeeper and add a string attribute named DialogueText to that prompt. This LocalScript shows a small, dismissible dialogue panel on the player's screen whenever they activate a prompt with that attribute. You can reuse the same panel for any number of NPCs. Keep each message short enough for phone screens and test that unrelated prompts remain silent.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local player = game:GetService("Players").LocalPlayer
local prompts = game:GetService("ProximityPromptService")
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
gui.ResetOnSpawn = false
local panel = Instance.new("TextButton", gui)
panel.AnchorPoint = Vector2.new(0.5, 1)
panel.Position = UDim2.fromScale(0.5, 0.88)
panel.Size = UDim2.new(0.82, 0, 0, 105)
panel.TextWrapped, panel.Visible = true, false
panel.TextSize = 20
panel.Activated:Connect(function() panel.Visible = false end)
prompts.PromptTriggered:Connect(function(prompt, who)
	local text = prompt:GetAttribute("DialogueText")
	if who ~= player or typeof(text) ~= "string" then return end
	panel.Text = text .. "\n\nTap to close"
	panel.Visible = true
end)