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

How to make a spawn for only 1 person? [Solved - Unless someone wants to put a full script here :3]

Asked by 10 years ago

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?

2 answers

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

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

Ad
Log in to vote
3
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

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).

0
Can you explain and show me? DerpyShadowz 34 — 10y
0
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); jakedies 315 — 10y
0
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) jakedies 315 — 10y
0
Oh okay thanks! DerpyShadowz 34 — 10y
View all comments (13 more)
0
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); jakedies 315 — 10y
0
Also add an end before the final end as I forgot it. jakedies 315 — 10y
0
Cool thanks a load DerpyShadowz 34 — 10y
0
Oh and btw, how do you do it for random people? Who I don't know? DerpyShadowz 34 — 10y
0
The first player who joins, or a random player in-game? Or some other way? jakedies 315 — 10y
0
Umm first goes to the 1st CustomSpawn then second goes to the 2nd CustomSpawn and so on DerpyShadowz 34 — 10y
0
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? jakedies 315 — 10y
0
No leave it open for the next person thanks. DerpyShadowz 34 — 10y
0
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. jakedies 315 — 10y
0
By next nil value, I mean first nil value. jakedies 315 — 10y
0
Ehh by that you mean? DerpyShadowz 34 — 10y
0
I'll write you up a script of what I'm thinking. jakedies 315 — 10y
0
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) jakedies 315 — 10y

Answer this question