Argument 1 missing or nil?

Ok so I am using this kick/ban script and on line 25 I get Argument 1 missing or nil.

admins = {275179893, 2313021745, 2443167764, 1530679372} -- Set this to the USER IDS of the players that you trust with the commands.
prefix = "/" -- ONE character only!

ds = game:GetService("DataStoreService"):GetDataStore("Bans")
server_banned = {}
game.Players.PlayerAdded:Connect(function(p)
	banned = ds:GetAsync(p.UserId) or false
	if banned then p:Kick("You Were Banned By A Moderator. Ban ID: 9095") return end
	for _,v in pairs(server_banned) do if v == p.UserId then p:Kick("You are banned from this server.") return end end
	admin = false
	for _,v in pairs(admins) do if v == p.UserId then admin = true end end
	if not admin then return end
	p.Chatted:Connect(function(m)
		if m:sub(1, 6) == prefix .. "kick" then
			u = tonumber(m:sub(6))
-- THIS IS THE ISSUE			u = game.Players:GetPlayerByUserId(game.Players:GetUserIdFromNameAsync()) -- THIS IS THE ISSUE
			if not u then return end
			admin = false
			for _,v in pairs(admins) do if v == u.UserId then admin = true end end
			if admin then return end
			u:Kick("You were kicked from this server, by a RAGE Official Moderator!")
		elseif m:sub(1, 5) == prefix .. "ban" then
			u = tonumber(m:sub(5))
			u = **game.Players:GetPlayerByUserId(game.Players:GetUserIdFromNameAsync())**
			if not u then return end
			admin = false
			for _,v in pairs(admins) do if v == u.UserId then admin = true end end
			if admin then return end
			table.insert(server_banned, u.UserId)
			u:Kick("You are banned from this server.")
		elseif m:sub(1, 6) == prefix .. "pban" then
			u = tonumber(m:sub(6))
			u = game.Players:GetPlayerByUserId(game.Players:GetUserIdFromNameAsync())
			if not u then return end
			admin = false
			for _,v in pairs(admins) do if v == u.UserId then admin = true end end
			if admin then return end
			ds:SetAsync(u.UserId, true)
			u:Kick("You Were Banned By A Moderator: Ban ID: 9095")
		end
	end)
end) 

image

Please help, I’ve never seen this issue before.

You did not put anything in the parenthesis of the function
game.Players:GetPlayerByUserId(game.Players:GetUserIdFromNameAsync())
The function requires you to put something there

u = game.Players:GetPlayerByUserId(p.UserId)
This should work

1 Like

So do I put

game.Players:GetPlayerByUserId(game.Players:GetUserIdFromNameAsync(p.UserId))
or 
game.Players:GetPlayerByUserId(p.Userid 

as the final script.

The second one
game.Players:GetPlayerByUserId(p.Userid )