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

How do I make it so when a certain player joins something happens to them?

I know some part of the script ~~~~~~~~~~~~~~~~~ function onPlayerEnter:connect

I think XD

2 answers

The event you are looking for is PlayerAdded:

Names = {"PlayerNameHere"}
game:GetService("Players").PlayerAdded:connect(function(Plr)
	wait(1/30)
	for _,v in next, Names do
		if v:lower() == Plr.Name:lower() then
			--Stuff happens here
			--Example: Plr.Character:BreakJoints()
		end
	end
end)

2 comments

0

That's close to what i need I really need if the players name is in the script so and so happens

0

Edited it so that if your username in in the table, only then does stuff happen.

Use this example instead, it is more safer.

game.Players.PlayerAdded:connect(function(player)
	repeat wait() until player ~= nil
	-- code here :)
end)

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