Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Comparing based on word not capital?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

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

Log in to vote
2
Answered by 8 years ago
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
Or :upper() for upper cases. Redbullusa 1580 — 8y
Ad

Answer this question