so i have this modulescript here that will check if the last character in the text is a period, question mark, exclamation point, comma, colon, or semicolon, but for some reason, it's marking every character as a period/question mark/exclamation point. i think this might have to do with the or statements? here's the code:
local player wait(1) player = game.Players:FindFirstChildWhichIsA("Player") local db = player.PlayerGui.ScreenGui.DialogueBox function Dialogue(text) for i=0,string.len(text) do db.Text.Text = string.sub(text, 1, i) player.PlayerGui.Beep:Play() if string.sub(db.Text.Text, string.len(db.Text.Text)) == "." or "?" or "!" then wait(1) elseif string.sub(db.Text.Text, string.len(db.Text.Text)) == "," or ";" or ":" then wait(0.5) end wait() end wait(1) game.ReplicatedStorage.DProgressed.OnServerEvent:Wait() end return Dialogue
The problem is your if statements. When using "or", the code searches for a new condition after every "or".
It should look like this:
if string.sub(db.Text.Text, string.len(db.Text.Text)) == "." or string.sub(db.Text.Text, string.len(db.Text.Text)) == "?" or string.sub(db.Text.Text, string.len(db.Text.Text)) == "!" then 13 wait(1) 14 elseif string.sub(db.Text.Text, string.len(db.Text.Text)) == "," or string.sub(db.Text.Text, string.len(db.Text.Text)) == ";" or string.sub(db.Text.Text, string.len(db.Text.Text)) == ":" then
I apologize for the formatting. My iPad is not made for coding (or typing, really). This should solve your problem.