Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I move the player to a Part?

Hey. I'm trying to move the player to a Part's position but it doesn't work. Any ideas why?

This is the code:

local b = Instance.new("BodyPosition")
        	b.position = Vector3.new(game.Workspace.Point.Position)
        	b.maxForce = Vector3.new(500000000, 500000000, 500000000)
        	b.Parent = character.Torso

8 comments

0

Don't Position and MaxForce need an uppercase at the beginning?

0

I don't think so since it does move the player. The BodyPosition doesn't move the player to the part's Position.

0

Try: game.Workspace:WaitForChild("Point").Position

0

Tried with no success :(

0

Oh I know, you are creating a new Vector3 when Position is already a Vector3

0

Just use b.Position = game.Workspace.Point.Position

0

It worked :D Thanks

0

:D Welcome

2 answers

It's easy buddy. There is many ways you can do this. I will put 2 of these right below.

Teleport a player to a position when clicking something:


script.Parent.ClickDetector.MouseClick:connect(function() --Add a "ClickDetector" to the scripts parent

local player = game.Players.LocalPlayer
local playername = player.Name

game.Workspace:WaitForChild(playername).Torso.CFrame = CFrame.new(Enter position here)

end)

 --Change "Torso" to "UpperTorso" if you're using R15. 
--If you're using R6 then don't change anything.

Now if you want a player to teleport when touching a part:

script.Parent.Touched:connect(function(hum) 

local player = game.Players.LocalPlayer
local playername = player.Name

hum.Parent:WaitForChild("Humanoid") --We only want to teleport players!
game.Workspace:WaitForChild(playername).Torso.CFrame = CFrame.new(Enter position here)

end)

 --Change "Torso" to "UpperTorso" if you're using R15. 
--If you're using R6 then don't change anything.

I hope I helped you!

1 comment

0

2/8/2021 use codeblocks

This discussion is preserved as it was. New answers, comments, and votes are closed.