so i have different NPCs for different shops. i want each NPC to have different dialog text.
because this is my custom proximity prompt script, i was thinking about sending the CharacterAttribute value which holds the NPC’s name to another local script in my dialog UI so i can organize stuff better and handle the text from there. unfortunately i’ve never handled multiple dialog UI’s for different NPCs so i’m kinda stuck rn so i appreciate any help at all ty. ![]()
custom proximity prompt script (stored in starterplayerscripts)
local function OnTriggered(prompt, playerWhoTriggered)
if debounce[playerWhoTriggered] then return end
debounce[playerWhoTriggered] = true
local object = prompt.Parent
local CharacterAttribute = object:GetAttribute("Character")
print("you're interacting with "..CharacterAttribute.."!")
end
local function ConnectPromptEvent(event, callback)
event:Connect(function(prompt, ...)
if prompt.Style == Enum.ProximityPromptStyle.Default then return end
callback(prompt, ...)
end)
end
ConnectPromptEvent(ProximityPromptService.PromptTriggered, function(prompt, playerWhoTriggered)
OnTriggered(prompt, playerWhoTriggered)
end)
i’m trying to hook the Dialog text up to the text in my CharacterData module which is my end goal.
local CharacterData= {
["Dodgy Darren"] = {
ObjectText = "Dodgy Darren",
ActionText = "Talk",
ObjectTextColor = Color3.fromRGB(255, 0, 4),
ActionTextColor = Color3.fromRGB(255, 249, 65),
Options = {
"[Who are you?]",
"[Why is your name Dodgy Darren?]",
"[Why are you here?]",
"[I think I'll go now...]"
}
},
["Trading Tadhg"] = {
ObjectText = "Trading Tadhg",
ActionText = "Talk",
ObjectTextColor = Color3.fromRGB(255, 255, 255),
ActionTextColor = Color3.fromRGB(255, 249, 65),
Options = {
"[I want to sell my inventory]",
"[I want to sell this]",
"[How much is this worth?]",
"[Nevermind]"
}
},
return CharacterData

