#Dialogue System not working

1 messages · Page 1 of 1 (latest)

boreal hedge
#

Hello, I need help regarding this dialogue system I've written up with the guidance of several tutorials. Currently none of the Gui or strings will appear when i'm interacting with the npc in question, and I'm totally stumped as to why. Any and all help will be greatly appreciated!


local currentDialogue = 1
local nextDialogue = currentDialogue + 1

local dialogueMod = require(script:WaitForChild("DialogueMod"))
local dialogueSequence = script:WaitForChild("DialogueSequence")
local targetDialogue = dialogueSequence:FindFirstChild(currentDialogue)

NPC.ProximityPrompt.Triggered:Connect(function()
    if currentDialogue > #targetDialogue or dialogueMod.IsActive then return end
    dialogueMod.Activate(targetDialogue, 0.003, NPC)
    currentDialogue = nextDialogue
end)```
#

Here's the dialogue module btw, just couldn't fit it all into one initial message ToT

    
local dialogueGui = game:WaitForChild("DialogueScreen")
local dialogueBox = dialogueGui:WaitForChild("DialogueBox")
local nametag = dialogueGui:WaitForChild("Nametag")

local dialogue = game:WaitForChild("DialogueText")
local name = game:WaitForChild("NameText")

local active = false

local player = game.Players.LocalPlayer

local dialogueSequence = script:WaitForChild("DialogueSequence")
local targetDialogue = dialogueSequence:FindFirstChild(currentDialogue)

local currentDialogue = 1

local nextDialogue = currentDialogue + 1

local function OpenDialogue()
    dialogueBox.Size = UDim2.new(0,0,0,0)
    nametag.Size = UDim2.new(0,0,0,0)
    dialogueBox.Visible = true
    nametag.Visible = true
    ts:Create(dialogueBox, TweenInfo, {Size = UDim2.new(0.443,0,0.139,0)}):Play()
    ts:Create(nametag, TweenInfo, {Size = UDim2.new(0.078,0,0.46,0)}):Play()
    task.wait(1)
end

local function CloseDialogue()
    ts:Create(dialogueBox, TweenInfo, {Size = UDim2.new(0,0,0,0)}):Play()
    ts:Create(nametag, TweenInfo, {Size = UDim2.new(0,0,0,0)}):Play()
    task.wait(1)
    dialogueBox.Visible = false
    nametag.Visible = false
end

local function PrintDialogue(text, interval)
    dialogue.Text = ""
    for _, letter in pairs(string.split(text, "")) do
        dialogue.Text ..= letter
        task.wait(interval)
    end
    task.wait(0.3)
    dialogue.Text = ""
end

local function PrintName(text)
    name.Text = ""
end

function dialogue.IsActive()
    return active
end

function dialogue.Activate(text, interval)
    if active then return end
    active = true
    player.Character:WaitForChild("Humanoid").WalkSpeed = 0
    OpenDialogue()
    PrintName(text)
    PrintDialogue(text,interval)
    CloseDialogue()
    player.Character:WaitForChild("Humanoid").WalkSpeed = 16
    active = false
end```
scarlet ruin
#

you probably getting errors

scarlet ruin
boreal hedge
#

What makes you say so?

#

And the output wasn't throwing back any errors strangely

scarlet ruin
boreal hedge
scarlet ruin
boreal hedge
#

yep

scarlet ruin
#

add a print somewhere

boreal hedge
#

Strange, I added a print and the output is still blank

scarlet ruin
#

in fact, make a new empty script with only a print in it.

#

if that doesn't print then you have lua virus most likely from toolbox model

boreal hedge
#

Oh mb! lemme do that rq

shy furnaceBOT
#

studio** You are now Level 1! **studio

scarlet ruin
#

you probably got localscripts in workspace or smth either way there's your problem. hope that helps salute

boreal hedge
#

OH yes I do in fact

#

I wasn't aware localscripts cant run in workspace

boreal hedge
scarlet ruin
#

if someone is stuck usually the main problem is debugging and diagnostics. you can't fix a problem if you don't know what the cause is. that should be enough salute

boreal hedge
#

Thank you for the help! I'll be sure to start reworking it for the new location as my next step ^-^