Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you check if a character is equal to a comma? [ANSWERED]

Hello, this is my script:

script.Parent.Text = "Instuctions soon..."
wait(7)
local Texts = {
	"Hello and welcome to BattleField[STORY MODE]!";
	"If you win this round, you will get a exclusive BattleField Sword.";
	"Good Luck!";
}

for n = 1, #Texts,1 do
	wait(2)
	for i = 1, #Texts[n], 1 do
		wait(0.05)
		if tostring(Texts[n][i]) == "," then
			print("Comma!")
			wait(0.05)
		end
		script.Parent.Text = string.sub(Texts[n], 1, i)
	end
end

On line 13, I am trying to check if that part of the string is a comma, but it doesn't work. Everything else works. Any help is appreciated =)

1 answer

I figured out the solution. Basically this is how to solve it:

if string.sub(Texts[n], i, i)== "," then

2 comments

0

edit your original question and add (Solved) to the title so we know it's solved. :)

0

Alright

This discussion is preserved as it was. New answers, comments, and votes are closed.