How do you make a spawn for only 1 person, as in it doesn't show on the leaderboard, but that person has they're own spawn, they won't spawn anywhere else. Just that spawn, even if they're in the same team as someone else?
Like ControlSpawning?
How do you make a spawn for only 1 person, as in it doesn't show on the leaderboard, but that person has they're own spawn, they won't spawn anywhere else. Just that spawn, even if they're in the same team as someone else?
Like ControlSpawning?
Full script
Name = "Person you want to spawn there" --Specify the player
Spawn = "Name of the spawn here" --Get the name of the spawn
spwn = game.Workspace:FindFirstChild(Spawn) --find something named that in the workspace
game.Players.PlayerAdded:connect(function(plr) --Wehn a player enters the game
plr.CharacterAdded:connect(function(char) --then when their character enters
wait(1) --wait a second
if char.Name:lower() == Name:lower() then --and check if they have the specified name
char.Torso.CFrame = CFrame.new(spwn.Position+Vector3.new(0,5,0)) --move them
end
end)
end)
Hope I Helped
+1
You can create a part in Workspace and call it "CustomSpawn" then use the CharacterAdded event on the specific player and move him to the part's position (use MoveTo as opposed to SetPrimaryPartCFrame so they will spawn on-top of the part, not inside).
This discussion is preserved as it was. New answers, comments, and votes are closed.
17 comments
Can you explain and show me?
I'll assume you know how to do the first part. Let's say you wanted to always spawn there, you can use the PlayerAdded event to detect if anyone has joined, and if that player's name is your name you would attach the CharacterAdded event to him then move him. You can move him doing: character:MoveTo(workspace.CustomSpawn.Position);
Oh, I forgot to give you some links that my help you about the events: http://wiki.roblox.com/index.php?title=PlayerAdded_(Event) and http://wiki.roblox.com/index.php?title=CharacterAdded_(Event)
Oh okay thanks!
Game.Players.PlayerAdded:connect(function(player) if player.Name == "MasterPoke99" then player.CharacterAdded:connect(function(character) wait(1); character:MoveTo(workspace.CustomSpawn.Position); end); end);
Also add an end before the final end as I forgot it.
Cool thanks a load
Oh and btw, how do you do it for random people? Who I don't know?
The first player who joins, or a random player in-game? Or some other way?
Umm first goes to the 1st CustomSpawn then second goes to the 2nd CustomSpawn and so on
You can create x amount of spawns (Use a naming convention like Spawn1, Spawn2, ..., Spawn6) depending on the how many you want. But before I can continue, how will you handle when a player when they leave? Do you want to shift everyone "back" a Spawn?
No leave it open for the next person thanks.
Alright, you would probably want to append any new player into a table and when they leave, directly set their position in the table to nil (without shifting the table, do not use table.remove) and when someone joins you can insert them into the next nil value and you will have a table with each value being a unique ID in which you can use for the spawn part.
By next nil value, I mean first nil value.
Ehh by that you mean?
I'll write you up a script of what I'm thinking.
local workspace, players = Game:GetService("Workspace"), Game:GetService("Players"); local players = {}; local getNextNil = function() for key = 1, #players do if players[key] == value then return key; end end return #players + 1; end; players.PlayerAdded:connect(function(player) local nextID = getNextNil(); players[nextID] = player; player.CharacterAdded:connect(function(character)