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

How could I make my friends spawn? [Solved]

I was wondering how I could make my friends spawn on a certain spawn. Here is the script I have tried:

FSpawn = Game.Workspace.FriendSpawn
PAdded = game.Players.PlayerAdded

PAdded:connect(function(player)
	if player:IsFriendsWith(13299101) then
		PAdded.MoveTo.Fspawn
	end --Here, it says "'=' expected near 'end'" and I don't know what to do. Help?

Please help?

--Now, how can I make the friend be on the friends team?--

1 comment

0

btw, the error on your script says that it needs another end..

1 answer

✓ Accepted answer

The syntax is incorrect. What you need to do is use the CharacterAdded event on the Player from the PlayerAdded, then teleport the player's Character (the in-game model that represents them) to your spawn.

local spawn = Workspace.FriendSpawn

game.Players.PlayerAdded:connect(function(player) -- when a player is added, this happens
	player.CharacterAdded:connect(function(char) -- when the player's character is added, this happens
		if player:IsFriendsWith(13299101) then -- if the player is friends with you,
			char:MoveTo(spawn.Position) -- move their character to the position of the Friendspawn
		end
	end)
end)

2 comments

0

Ok, now how would I have them switch teams?

0

You can have them switch teams by using "game.Players.PLAYERNAME.TeamColor = BrickColor.new("Color")".

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