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

How could I make my friends spawn? [Solved]

Asked by 10 years ago

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?--

0
btw, the error on your script says that it needs another end.. lomo0987 250 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

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)
0
Ok, now how would I have them switch teams? titan111 0 — 10y
0
You can have them switch teams by using "game.Players.PLAYERNAME.TeamColor = BrickColor.new("Color")". SlickPwner 534 — 10y
Ad

Answer this question