Argument 1 missing on nil

  1. What do you want to achieve? Keep it simple and clear!
    Get rid of errors
  2. What is the issue? Include screenshots / videos if possible!
    Argument 1 missing on nil
  3. What solutions have you tried so far?
    nothing.
game.ReplicatedStorage.Remotes.Warrant.OnServerEvent:Connect(function(PlayerCalled, interact, test, field, textBox, comboBox)
	if CanCuff(PlayerCalled) then
		if game.Players:FindFirstChild(field) then -- problem here
			local player = game.Players[field]
			if test == "Search Warrant" then
				print("Search Warrant")
			end
			if test == "Arrest Warrant" then
                print("Arrest Warrant")
			end
			while true do
				wait(60)
				if game.Players:FindFirstChild(field) then
					for i,v in pairs(game.Players:GetChildren()) do
						if CanCuff(v) then
							if test == "Arrest Warrant" then
								print("Arrest Warrant")
							end
						end
					end
				end
			end
		else
			print("Target must be in game")
		end
	end
end)
1 Like

What is field? I don’t think you need the parameter since you can just use PlayerCalled.

field is the person who handcuffs on in game

or maybe target someone on search warrant

Is it a player or a string? If it is a player, you can check by using if field.Parent then,
otherwise, you’d have to fire Player.Name in your case. Also the error is showing that field is nil, meaning that either it isn’t fired or it is straight up nil.

then error: attempt to index nil with ‘Parent’

It’s string. I was found a coding on other scripts

You are not using the first paramater in your function.

They actually can take as many arguments as you want. They call it a tuple.

@1TextCode what line is the error on?

1 Like

Do print(field) if it return nil then the problem is when you fire the event field is missing.

3 line are error. I use field mean person who set to search warrant, it was from textbox.text.

I did When I tries use print(field) then it’s message says “nil”

Can I see your client side script which fires the event.

  • warrantRemote mean add remote event
  • textBox mean add textbox
  • field mean add textbox
  • combox mean add textbox
  • test mean text
  • interact mean press gui like if door press e then door is open

warrantRemote:Fire(interact.Id, test, field:GetText(), textBox:GetText(), comboBox.Selected)

You should check

if field then

end

at the start because it seems like there is no text entered when you fire it.

then error: “Argument 1 missing on nil”

I think it would be fine. because there are many problems.