Hello devforum! I was trying to make a dialogue system like Fisch, but I stumbled upon a bug in the code. Whenever I try to change the textlabel text to the desired one, the text changed AFTER the code ran (when the billboardgui was hidden), ive tried multiple solutions, but none of them worked. Heres a slice of code from the module I created, I will provide more if needed:
local function TypeDialogue(textlabel : TextLabel, text : string, speed : number)
for i = 1, #text do
textlabel.Text = string.sub(text, 1, i)
task.wait(speed)
end
end
function module.ShowDialogue(npc : Model, plr : Player, object : BillboardGui, textlabel : TextLabel, text : string, speed : number)
if not npc or not plr or not object then
warn("No NPC/Player/UI!")
return
else
local dialogue = object:Clone()
dialogue.Parent = npc.Head
dialogue.Enabled = true
TypeDialogue(textlabel, text, speed)
end
end
Can someone tell me why this happens? Thanks in advance! (sorry if the code is a bit silly, im still a beginner and i tried making up my own ideas)