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

Making a player enter "detect" script?

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

✓ Accepted answer
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)

1 comment

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

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