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

[Solved]How can I teleport a player to another player without getting stuck in surrounding objects?

Asked by 6 years ago
Edited 6 years ago

I am working on a project for someone and they asked me to script a command where a certain rank person can say :assist and a higher rank person will be teleported to them(in game of course). At first I thought I would just use the CFrame of the player that I am teleporting to and add a certain amount to the y. However, I thought about ceilings and realized my idea was not so great after all. Is there any way I can check around a player for an empty space to spawn in. Note: I am asking for a method not a script. Thanks!

0
Raycasting Rare_tendo 3000 — 6y
0
are you sure? User#21908 42 — 6y
0
can I use a for loop and when an open space is found return that area? User#21908 42 — 6y
0
is it possible to break out of a for loop? User#21908 42 — 6y
View all comments (4 more)
0
If you change the player's HumanoidRootPart.Position, roblox will check if it has enough space, and if it dosen't it will bump up the Y axis until it does. LollipopCraft 1 — 6y
0
I would recommend when you teleport the player, add a little offset of maybe a Vector3.new(0, 0, 15). Just an idea User#19524 175 — 6y
0
@incapaz, what if there's a wall at the offset? Golubian 37 — 6y
0
ok thanks guys! I am planning on doing an offset after casting a ray in that direction. We will see if it works. User#21908 42 — 6y

2 answers

Log in to vote
1
Answered by
DjMusa2 81
6 years ago

Maybe you can use a script that will make you go threw the surrounding objects....Maybe find on YouTube? Note: Dont use AlvinBlox, people told me he's bad.

Ad
Log in to vote
0
Answered by 6 years ago

use rays and :FindPartOnRay(Ray) to calculate how big an area is then tp or disable player to player collision and do :SetPrimaryPartCFrame(Teleportingtoplayersprimarypart.CFrame)

0
make sure its the ray hit position and not the part position 129Steve129 7 — 6y

Answer this question