Hi,i hope everyone is doing fine.
I have stumbled across this problem when making a dialogue system
Somehow the text prints on the output but when i try to change it on the textbox it wont change
Heres my code:
Read=function(data,MG)
local gui=MG
local frame=gui.Frame
local TextB=script.Parent.DialogueGui.Frame.TextBox
local Answer1=frame.Answer1
local Answer2=frame.Answer2
local Answer3=frame.Answer3
for i=1,#data do --PAIN
local CData=data[i]
frame.Transparency=CData.Transparency
frame.BorderSizePixel=CData.BorderPixel
local CanContinue=false
if CData.OpenSpeed==0 then
CanContinue=true
end
if CData.OpenSpeed~=0 then
frame.Size=UDim2.new(0.001,0,0.001,0)
local Time=CData.OpenSpeed
local NTween = CreateTween(frame, {Time, CData.EasingStyle, CData.EasingDir, 0, false, 0},{
Size=UDim2.new(1, 0,0.342, 0),
}, true)
NTween.Completed:Connect(function() CanContinue=true end)
end
repeat wait() until CanContinue==true
if CData.Answer==false or CData.Answer==nil then
TextB.Visible=true
TextB.TextScaled=CData.TextScaled
TextB.TextColor3=CData.TextColor
TextB.TextSize=CData.TextSize
TextB.Font=CData.TextFont
TextB.TextStrokeTransparency=CData.TextStrokeTransparency
TextB.TextStrokeColor3=CData.TextStrokeColor
print(CData.Text)
for TextPosition=1,#CData.Text do
local CurrentText=string.sub(CData.Text,1,TextPosition)
print(CurrentText)
TextB.Text=CurrentText
wait(CData.Speed or 0)
end
wait(CData.WaitUntilNext)
end
end
end
Read(read,script.Parent.DialogueGui)
I believe the problem is in this part?
for TextPosition=1,#CData.Text do
local CurrentText=string.sub(CData.Text,1,TextPosition)
print(CurrentText)
TextB.Text=CurrentText
wait(CData.Speed or 0)
end
Shouldn’t be though since the print does print the text properly and TextB isnt nil (i checked),
As you can see here:
Yet…
The Text property wont change.
In fact it turns blank as you can see but in the properties tab on studio it shows that it’s the default text.
Note:this code is inside a local script and im getting the text from a module script (shouldn’t be a problem since it prints).
Its kinda weird cause if i do:
while wait() do script.Parent.DialogueGui.Frame.TextBox.Text=tostring(math.random(0,300)) end
It works properly as you can see here:
Any help would be apreciated