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

How do i teleport the player (just one) to a certain place?

Asked by 7 years ago

I tried:

game.Workspace.Player.Torso.Position = Vector3.new(-165.91, 1331.55, 302.289)

but it doesn't teleport the player there.

Second Question,

I have a Gui that gives the player the ability to choose their team (This would compare with my first question) that he/she choose. So say the player choose Team Red from a Gui, and it would teleport the player to the Red Team Spawn Location so I did this for something:

if game.StarterGui.GunPicker.NameOfGuns.For_PrimaryFrame.Gun_Name_Of_Pick.Text == '---' then
    DeployButton.Visible = false
    end

Don't worry about the stuff inside the if then statement.

So in the Outlook it said that NameOfGuns is not a valid member of ScreenGui One, the name of the Gui in it (NameOfGuns Parent) is not ScreenGui

So if anyone can help me with this problem I would be happy, thanks!

1 answer

Log in to vote
2
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

First off all, for teleportation, you'll have to use CFrame instead of Position

function TriggerTP(Player)
    Player.Character.Torso.CFrame = CFrame.new(x,y,z)
end

For your second question, You shouldn't change gui's in StarterGui, but in Players.PLAYER.PlayerGui

StarterGui is the gui that gets given to a player when he/she joins the place / resets (on respawn).

Please add more code for us to solve your second question. (Or put it in a different question.)

0
You can also use the :MoveTo() function on the Character UltimateRaheem 75 — 7y
0
If you teleport it right next to a block using MoveTo, it could be teleported all the way on top. RubenKan 3615 — 7y
0
Ok let me test it so i can accept the answer. But thank you! Chez_Guy 67 — 7y
0
@RubenKan It didnt seem to work...And it didnt seem to work with if then statements... Chez_Guy 67 — 7y
0
Oh i got it! thank you! Chez_Guy 67 — 7y
Ad

Answer this question