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

How do i check if a letter or a word is a part of a full string?

So, i have this script where i want the text to have a typewriting effect, but it keeps on doing it on the intermission and the map voting, so it will typewrite like this:

intermission: 15 intermission: 14

and so on untill it reaches 0.

how do i check if a word or letter is a part of the value?

here is my script:

local status = game.ReplicatedStorage:WaitForChild("Values"):WaitForChild("Status")
local sound = game.SoundService:WaitForChild("Talk")
local label = script.Parent

label.Text = status.Value

local function makeText(obj,text)
	for i = 1,#text,1 do
		obj.Text = string.sub(text,1,i)
		sound:Play()
		wait(0)
	end
end

status:GetPropertyChangedSignal("Value"):Connect(function()
	makeText(label,status.Value)
end)

help would be appreciated!

1 answer

✓ Accepted answer

You can use the string.find function. Here is an example of it working:

local str = "Hello world!"
if string.find(str, "Hello") then
	print("The string contains Hello.")
end

The first argument is the string you want to search, and the second argument is the query.

Hope this helped

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