#The text for the dialogue doubles after the first interaction
1 messages Ā· Page 1 of 1 (latest)
whats open doing
Sorry for the late response @neon spruce
i dont see anything immediately wrong in your code
the only thing i can think of is the button.mousebuttton1click event is being called twice
so every time the dialogue is activated its being duplicated
so there is 1 connection
then 2 connections
then 3
etc
i dont think his code goes wrong in the letter typing part
hes doing ..= letter
which should work the same
ye but maybe hes doing smt wrong with string.split or smt else
local TypeWriter = {}
TypeWriter.Type = function(textLabel: TextLabel, text: string, yieldTime: number, sound: Instance?)
textLabel.MaxVisibleGraphemes = 0
textLabel.Text = text
for i = 1, utf8.len(text) do
if sound and sound:IsA("Sound") then sound:Play() end
textLabel.MaxVisibleGraphemes += 1
task.wait(yieldTime)
end
end
return table.freeze(TypeWriter)``` this module i use it for my current project and it works fine
maybe, but from the looks of it i think his mousebutton1click is just being connected twice
because i think hes connecting it every time the dialogue starts
instead of just having it connected once
or connecting it then disconnecting it after the dialogue is over
ooooooh i just read that part above the images im blind lmao
yea maybe he is connecting the connection twice
or clicking the button twice or smt
it gets connected once evry time the dialogue begins so first time it gets connected once, then a second time, then a third, etc
yea ik
its causing a memory leak too
its better to use :Once
i know im a bit late but "utf8.len(text)" doesnt work as it needs a string instead of a number
wdym it doesnt work
it works fine for me
It needs a number for the .len()
I'm using a string
no?
u just pass the string and done
I'll try it but it says there's an error
huh send a screenshot
huh
but what the error says?
on the script it says this
r u using strict mode?
wym.. š
i mean --!strict
uhh
i dont see any problem
yeah but why is it underlined as an error š
yeah it does
what does the error say
maybe is deprecated
but the documentation doesnt say anything about it
and on my module it doesnt show that error
its possible it doesnt like utf8.len potentially returning 2 values when you only want to use one of them
it wouldn't work then but ok
no bc utf8.len its like doing #text but works a little bit differnet
or the fact that the values are nullable
btw the text doesnt "double" now
yep its cause the return values are nullable
if you want to fix it you can just put or 0 after utf8.len(text)
so it defaults to 0 if it returned nil
or just remove the --!strict
or that