Attemp to index nil with lower

  1. What do you want to achieve? Keep it simple and clear!
    A short username detect like /sync paulo = /sync paulocezarnbr

  2. What is the issue? Include screenshots / videos if possible!
    attempt to index nil with lower

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Edit the script.Yes.

script(Server):


local syncstring = "/sync ([%w_]+)"
local leavesync = "/unsync"

local function shortname(user)
	for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
		local user = user:match(syncstring)
		if user:lower() == (plr.Name:lower()):sub(1, #user) then
			return plr.Name
		end
	end
end

local user = user:match(syncstring)

is returning nil

something like this may work better for the line:

local user = string.gsub(user, "/sync ", "")
1 Like