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

Comparing based on word not capital?

I'm trying to make it compare to a string, and ignore capitals ie:

I LIKE HOTDOGSthen compares to I like hotdogs

and because it's the same words and ignoring upper or lower case it will continue

game.Players.PlayerAdded:connect(function(plr)
	local defined = {}
	plr.Chatted:connect(function(msg)
		if admins[plr.Name] then
			if msg == --[[????]] then --Checks to see if the message is the same word, ignoring capitals completely 
				local target = string.gsub(msg,"Sanic:","")
				if game.Players:FindFirstChild(target) then
					if game.Workspace[target]:FindFirstChild("Humanoid") then
						if game.Workspace[target]:FindFirstChild("Torso") then
							local sclone = script.Sets.Sonic:Clone()
							sclone.Parent = game.Players[target].Character.Torso
							sclone.Enabled = true
						end
					end
				end
			end
		end
	end)
end)

1 answer

✓ Accepted answer
lol1 = "LOL" -- all is capital
lol2 = "lOl" -- only o is captial

if lol1:lower() == lol2:lower() then
print("Works")
end

:lower() makes all string lowered so :lower() makes both string lower cased able to compare.

1 comment

1

Or :upper() for upper cases.

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