My special admin commands don't work

Hello, I made some admin commands for my game that change the value if it gets chatted by a specific player, I tested the commands and the commands work fine, but when I attempt to make it so it has to be a specific player saying it, it does not work. I get no error messages from this at all as well.

Here is my code (It’s not the commands it’s the check for player thing)

local testers = {
	["30745269"]="Stickpuppet",
}
game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(chat)
		if testers[plr.UserId] then
			if string.find(string.lower(chat),"set time1 ") then
				local time1 = string.lower(chat):gsub("set time1 ", "")
				script.time1.Value = time1
			elseif string.find(string.lower(chat),"set time2 ") then
				local time1 = string.lower(chat):gsub("set time2 ", "")
				script.time2.Value = time1
			elseif string.find(string.lower(chat),"set time3 ") then
				local time1 = string.lower(chat):gsub("set time3 ", "")
				script.time3.Value = time1
			elseif string.find(string.lower(chat),"set time4 ") then
				local time1 = string.lower(chat):gsub("set time4 ", "")
				script.time4.Value = time1
			end
		end
	end)
end)

Try changing the UserId inside the table to a number or using tostring on the player’s UserId.

local testers = {
	[30745269]="Stickpuppet",
}
game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(chat)
		if testers[plr.UserId] then
			if string.find(string.lower(chat),"set time1 ") then
				local time1 = string.lower(chat):gsub("set time1 ", "")
				script.time1.Value = time1
			elseif string.find(string.lower(chat),"set time2 ") then
				local time1 = string.lower(chat):gsub("set time2 ", "")
				script.time2.Value = time1
			elseif string.find(string.lower(chat),"set time3 ") then
				local time1 = string.lower(chat):gsub("set time3 ", "")
				script.time3.Value = time1
			elseif string.find(string.lower(chat),"set time4 ") then
				local time1 = string.lower(chat):gsub("set time4 ", "")
				script.time4.Value = time1
			end
		end
	end)
end)
3 Likes