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

Chat not case sensative?

I created 2 scripts using chat messages, but they are case sensative, I wanted to know how the heck I would make it not case sensative for future scripts as well as to fix these 2.

admin = { "Flavoured","conman0552","EPICBRO2004","Ramerion","Skylord170" }
game.Players.PlayerAdded:connect(function(nP)
for _,v in pairs(admin) do
if nP.Name == v then
nP.Chatted:connect(function(msg)
if msg == "close/Bricktops" then
local x = game.Workspace.Bricktops:Destroy()
wait()
end
end)
end
end
end)


admin = {"Flavoured","conman0552","EPICBRO2004","Ramerion","Skylord170" }

game.Players.PlayerAdded:connect(function(nP)
for _,v in pairs(admin) do
if nP.Name == v then
nP.Chatted:connect(function(msg)
if msg == "start/Bricktops" then
local x = game.Lighting.Bricktops:Clone()
x.Parent = game.Workspace
end
end)
end
end
end)

1 answer

✓ Accepted answer

You can achieve this using string.upper() or string.lower(). Personally, I prefer using string.lower(). Also, you can condense these 2 scripts into one if you'd like, since their contents are alike.

admin = { "Flavoured","conman0552","EPICBRO2004","Ramerion","Skylord170" }
game.Players.PlayerAdded:connect(function(nP)
	for _,v in pairs(admin) do
		if nP.Name == v then
			nP.Chatted:connect(function(msg)
				if string.lower(msg) == "close/bricktops" then -- Converts the message to all lowercase, and then compares it to an all lowercase string.
					if game.Workspace:FindFirstChild('Bricktops') then
						game.Workspace.Bricktops:Destroy()
						wait()
					end
				elseif string.lower(msg) == "start/bricktops" then -- Does the same.
					game.Lighting.Bricktops:Clone().Parent = game.Workspace
				end
			end)
		end
	end
end)

Hope this helped.

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