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

How to fix Missing Argument or nil for player?

Missing Argument or nil (line 3) , take a look:

local owner = script.Parent.Parent.Owner.Value
local player = game.Players.LocalPlayer


while true do 
	wait(0.1)
	if game.Players:FindFirstChild(owner) == owner then
		player:Kick()
		print("yay")
	else 
		print("none")
	end
end

4 comments

0

There is nothing on line 3?

0

Sorry - line 7

0

Also wdym "owner"?

0

the variable or the one inside the parenthesis?

1 answer

✓ Accepted answer

If you are trying to kick a player when they join a server (Like a ban list) then you're doing it wrong. You are looking through the LocalPlayer for the player named in the value owner. Meaning your not looking at all the players in the server. You would use a PlayerAdded event running when a player joins then you would check if the players' name = the value you want. Here are my edits below.

local owner = **LOCATION OF OWNER**
local Players = game:GetService('Players')
 
 
Players.PlayerAdded:Connect(function(plr)
	if plr.Name == owner then
		plr:Kick()
		print('Dead')
	else
		print('Yo safe')
	end
end)

Make sure this is in a ServerScript and not a LocalScript

If this helped you please mark as answered :D

2 comments

0

Does the ownerValue has to be a string or can it be an object Value

0

Nevermind, thanks by the way

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