How to see if a string has certain info in it

I want to make it so where if someone says "RUN NAME: " and it pops up the color background is another color called blue, if not then its normal I’m trying to see if there is certain info in the message to do this.

It simply won’t find the info right

SERVER SCRIPT

radioFolder.RunPlayer.OnServerEvent:Connect(function(PlayerRunne, ArrestsVal)
	local FrameTo_output = script.Parent.RadioFrame:FindFirstChild("Dispatch")
	FrameTo_output.LineSix.Text = FrameTo_output.LineFive.Text
	FrameTo_output.LineFive.Text = FrameTo_output.LineFour.Text
	FrameTo_output.LineFour.Text = FrameTo_output.LineThree.Text
	FrameTo_output.LineThree.Text = FrameTo_output.LineTwo.Text
	wait()
	FrameTo_output.LineOne.Text = "DISPATCH: "..PlayerRunne.Name.." was Arrested "..ArrestsVal.." times!"
	if FrameTo_output.LineOne.Text == (string.split("Dispatch: ")[3]) then
		FrameTo_output.LineOne.BackgroundColor3 = Color3.fromRGB(57, 141, 177)
	end
end)```
1 Like

Yes sir that is correct my man

If your finding words or patterns in a string, use string.find, or string.match which can be found here.

Thank you have a nice one. It kinda helped thank you.

There is also string.match()

Example:

local ExampleString = "this is an example string"

if string.match(ExampleString, "this is") then
    Print("match")
end

The first parameter is the string to compare, and the second parameter is the string your are looking for inside of the comparison string.

(sorry if that didn’t make sense)

Though they basically are used the same way I just thought I would give another option.

2 Likes

this is another solution, thank you for the help my man

1 Like

No problem. Happy to help! :grin: