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 a script that detects when a certain player has joined?

I want to make a script that detects if I joined or not, and if I do, it will change my team to a certain team. I just don't know how to do this...

3 answers

game.Players.PlayerAdded:connect(function(plr)
local p = plr.Name = "NickaalexTwo"
if p then
game.Players.NickaalexTwo.TeamColor = "COLOR NAME"
end)

Not sure if it will work i'm new to scripting.

local admins = {"NickaalexTwo"}

game.Players.PlayerAdded:connect(function(player)
	for _,v in pairs(admins:GetChildren()) do
		if v == player.Name then
			player.TeamColor = BrickColor.new("ColorName").Color -- I believe you need to add the .Color so that it will change the team color correctly.
		end
	end
end)

You need a entered event, and then a print event. You could try to connect the two to a string. Join the game, and it prints the players name into a stringvalue.

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