Is there a way to make it to where only certain people spawn at a certain location? Thanks.
~mastersniper7399
Yes, there is absolutely a way. But keep in mind to not ask such broad questions in the future, as they seem like a request and this isn't a request site.
So, what we'd need to do first is make a table full of the names of all the people we want to be able to spawn at the special spawn.
local peoples = {"Goulstem","mastersniper7399","A friend"}
Next we have to define the spawn they'd be spawning at.. assuming you have some sort of part in workspace named 'SpecialSpawn'.. or you can edit accordingly.
local spawn = workspace.SpecialSpawn
Now we have to have a PlayerAdded Event, this event will fire whenever a new player enters
game.Players.PlayerAdded:connect(function(plr)
And then we have to have a CharacterAdded Event from the 'plr' parameter, this will fire whenever that new player's character loads(respawns).
plr.CharacterAdded:connect(function(char)
Now we should wait until the Torso has loaded with the WaitForChild method, as the torso is what we will be CFraming to the spawn, and just for good measure.. wait .5 more seconds.
char:WaitForChild('Torso') wait(.5)
Now we iterate through our 'peoples' table(the table with all the people allowed to spawn at the special spawn) and if any name matches the new player's name then we CFrame the torso to the spawn's location
for i,v in pairs(peoples) do if v == char.Name then char.Torso.CFrame = spawn.CFrame * CFrame.new(0,3,0) end end
So, the full product?
local peoples = {"Goulstem","mastersniper7399","A friend"} local spawn = workspace.SpecialSpawn game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char:WaitForChild('Torso') wait(.5) for i,v in pairs(peoples) do if v == char.Name then char.Torso.CFrame = spawn.CFrame * CFrame.new(0,3,0) end end end) end)
Closed as Too Broad by Goulstem and M39a9am3R
This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.
Why was this question closed?