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

how do i teleport someone that hasn't been teleported yet by script?

Asked by 5 years ago
Edited 5 years ago

to explain this better, how do i make the script teleport someone that hasn't been teleported yet but doesn't teleport the person that it already teleported?

local plrs = workspace:GetChildren()
local Part = workspace:WaitForChild("BStage")

wait(1) 

Players = game.Players:GetPlayers()
Plr = Players[math.random(#Players)]
Plr.Character:SetPrimaryPartCFrame(Part.CFrame)
0
Insert a BoolValue into that player called "Teleported" and set to true once they did get teleported. User#19524 175 — 5y
0
im guessing i put the value in replicated storage? User#21093 0 — 5y
0
i put the bool in replicated storage, now how do i script it? User#21093 0 — 5y
0
Just put the BoolValue in the player and set it to false, then make something like if (player.BoolValue = false) then.... teleport, once the player has teleported set the value to true. LinKiNSpitZ 22 — 5y
View all comments (2 more)
0
yes if player.BoolValue.Value then ... else -- teleport player end User#19524 175 — 5y
0
where do i find the player? :/ ik this is frustrating but, i'm confused ... User#21093 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Theres a lot of way to implement this, and its really depend on how you want it to work exactly

e.g Player dies > Teleports him back to the round > don't teleport people inside the round

or Player joined the game > Teleports him somewhere or maybe you just want to teleport him once etc etc

one way you can do this is to add a bool somewhere when the player joined

game.Players.PlayerAdded:connect(function(ply)
    boolVal = Instance.new("BoolValue")
    boolVal.Name = "Teleported"
    boolVal.Parent = ply

end)

and then change the value to "True" and teleports him when his character spawned

game.Players.PlayerAdded:connect(function(ply)
    boolVal = Instance.new("BoolValue")
    boolVal.Name = "Teleported"
    boolVal.Parent = ply

    ply.CharacterAdded:connect(function(char)
        if ply.boolVal.Value == false then
            char.HumanoidRootPart:CFrame = YourTeleportLocationHere
            ply.boolVal.Value = true
        end
    end)
end)

This should teleport someone when they spawned, once

if this is not what you want. then you should give specific details on how you want your script to work

0
BTW use :Connect(), :connect() is deprecated AswormeDorijan111 531 — 5y
0
Welp, still works anyway Azure_Kite 885 — 5y
Ad

Answer this question