Hi,
I am trying to create a roleplaying game and I want to have the player to spawn on a random team pad but I am having trouble creating the script.
Any help would be appreciated.
Thanks.
local ParentPad = workspace.Spawns.Parent local KidPad = workspace.Spawns.Child local TeenPad = workspace.Spawns.Teenager local PetPad = workspace.Spawns.Pet
game.Players.PlayerAdded:connect(function(player) local TeamNumber = math.random(1,5)
if(TeamNumber == 1) then end if(TeamNumber == 2) then player:MoveTo(ParentPad.Position) end if(TeamNumber == 3) then player:MoveTo(ParentPad.Position) end if(TeamNumber == 4) then player:MoveTo(ParentPad.Position) end
end)
Hello,
The pads are the spawn locations.
Here is the full code:
local ParentPad = workspace.Spawns.Parent local KidPad = workspace.Spawns.Child local TeenPad = workspace.Spawns.Teenager local PetPad = workspace.Spawns.Pet game.Players.PlayerAdded:connect(function(player) local TeamNumber = math.random(1,5) if(TeamNumber == 1) then end if(TeamNumber == 2) then player:MoveTo(ParentPad.Position) end if(TeamNumber == 3) then player:MoveTo(ParentPad.Position) end if(TeamNumber == 4) then player:MoveTo(ParentPad.Position) end end)
Thanks.