(Sorry for my bad English in advance) I made a script which checks a string then writes it down on a textlabel. I also added a sound which then is played while the text is being writen in the textlabel (just like in undertale,pokemon etc). Now the problem lies in texts with space's within it. My script doesn't detect these spaces so it plays a sound when the script writes empty spaces (I only wanted to have it make a set noise when a letter is written and not a empty space).
localscript:
wait(3)
plr = game.Players.LocalPlayer
S = Instance.new("Sound",plr.Character.LowerTorso)
S.SoundId = "rbxassetid://4662452515"
text = "Hey there :D"
wait(1)
print("Starting!")
for i = 1, string.len(text) do
wait(.05)
if text[i] == " " then --- spacebar
print("empty text found")
else
S:Play()
end
end
As you can see I tried using
if text[i] == " " then print("empty text found") else blablabla
no print "empty text found" have been found in the outputbox can somebody explain why

1 comment
the local script is placed in the StarterPack