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

Teleport to random location?

Asked by 6 years ago

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)

0
what is "TeenPad" for in line two? SuperBeeperman 30 — 6y
0
Put the WHOLE script in the code block and I can help you hellmatic 1523 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago
Edited 6 years ago

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.

0
This don't willwork Leamir 3138 — 6y
Ad

Answer this question