Hello,
I am trying to make a dialogue skip where if the player is 50 counts in, they can skip it by clicking the mouse; Somehow this simple concept resulted with an error: attempt to compare number <= nil.
Whenever I do ==
it does not error but if I put <=
or >=
it errors.
Here’s the part of the script that errors:
local function typewrite(object,text,length)
for i = 1,#text,1 do
object.Text = string.sub(text,1,i)
task.wait(length)
txtam = i
print(txtam)
end
task.wait(6)
object.Text = ""
GUI.Enabled = false
end
if txtam >= 50 then -- error line
print("50 reached/over")
UIS.InputBegan:Connect(function(i,busy)
if busy then return end
if i.UserInputType == Enum.UserInputType.MouseButton1 and GUI.Enabled == true then
speed = 0.01
typewrite(DIALOGUE,DIALOGUETEXT,speed)
end
end)
end
Note: I have not included the full script, you can ask me for the full script in the replies.