Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix Missing Argument or nil for player?

Asked by 5 years ago

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
0
There is nothing on line 3? RealTinCan 217 — 5y
0
Sorry - line 7 awesomemode14 68 — 5y
0
Also wdym "owner"? voidofdeathfire 148 — 5y
0
the variable or the one inside the parenthesis? awesomemode14 68 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

0
Does the ownerValue has to be a string or can it be an object Value awesomemode14 68 — 5y
0
Nevermind, thanks by the way awesomemode14 68 — 5y
Ad

Answer this question