I was making a little thing that talks once clicked, however the debounce to prevent the player from spam click and messing up the text isn't working? It works of course without any errors
StringMessages = {'Hello My Name Is Bob','I am a lovely NPC','What about you?'}
Messages = 0
Sound = script.Parent.Sound
typing = false
function NextMessage()
Messages = Messages + 1
if Messages > #StringMessages then
Messages = 1
end
Length = string.len(StringMessages[Messages])
end
script.Parent.ClickDetector.MouseClick:connect(function()
if not typing then
typing = true
NextMessage()
for i=1,Length do
script.Parent.NameGUI.Tex.Text = (string.sub(StringMessages[Messages],1,i))
Sound:Play()
wait(.25)
end
end
typing = false
end)

1 comment
Thanks, it was this simple mistake I didn't catch ;)