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

Making a player enter "detect" script?

Asked by 10 years ago

what I mean is when a player enters it checks to see who it is

local function enter (player)
          -- What would go in between? a connect: block or a while true do block. Also how would it know to remove them if they were the certain player?
end

1 answer

Log in to vote
2
Answered by 10 years ago
function onEnter(p)
print (p.Name)  -- Prints player's name
end
game.Players.PlayerAdded:connect(onEnter)

OR

game.Players.PlayerAdded:connect(function(p)
print (p.Name)  -- Prints player's name
end)

RESPONSE TO YOUR COMMENT:

local banland = "noob jimmy nobodylikesme"
game.Players.PlayerAdded:connect(function(p)
    for w in string.gmatch(banland, "%a+") do
         if string.lower(p.Name) == string.lower(w) then
            p:Kick()
            break
        end
    end
end)
0
I need it so it kicks the person if their on the script. example: function onEnter (p) --print (p.NName) end Game.PlayerAdded:connect(onEnter) if p = NAME then game.Players.NAME:destroy() end paulieD123 5 — 10y
Ad

Answer this question