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

How do I teleport nearby players to a destination?

Asked by 6 years ago
Edited 6 years ago

So basically, my tool is a handheld teleportation device. When you click, you are moved to the spot where you clicked. I want to add a feature that teleport all players within a radius to the same spot as the user. For example,

Billy Bob has a brand new teleportation device. He uses it, and he gets moved to the spot where he clicked. Then, Suzie Q joined the server. She also had the teleportation device. If Suzie Q gets within a certain radius of Billy Bob when he uses the tool, she will get teleported along with Billy Bob. Only one player is required to use the tool. This works both ways. If Suzie Q uses it and Billy Bob is in a certain radius of her, he gets teleported to her destination. This should work for any amount of players.

I already have a simple script that teleports the player to wherever they click, but none of my scripts are working. One of them just teleported the players no matter where they were, one of them didn't work at all, and one of them teleported only the other players and not the user. I'm starting to get annoyed by all this failure. Here's a breakdown of what I need help with:

All players within a radius of the user get teleported along with the user when they click. Only one player is required to use the tool. Read above if this isn't enough explanation...

Here is my LocalScript: (Inside my tool)

repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Body = Player.Character
local Mouse = Player:GetMouse()
local Tool = script.Parent
Tool.Activated:connect(function()
    local Hit = Mouse.Hit
    Body:MoveTo(Hit.p)
end)

At this point, I appreciate absolutely ANYTHING. And if you explain please explain magnitude, to me magnitude is the easiest to understand, and I already know a few things about it, whereas other methods such as region3 I am clueless. And please don't give me a FE script because if I enable FE all my other scripts break and I'm too lazy to convert them all.

0
Magnitude is a simple way of getting how close a part is to another. For example, you do (start - finish).magnitude and if those are 1 stud apart, it would return 1. Region3 covers a square, like the top right tip of a part and a bottom left tip of a part. hiimgoodpack 2009 — 6y
0
I guess what I'm really asking is how the heck I do tables because this kind of thing is probably impossible without tables User#18979 5 — 6y
0
Don't ask for Non-FE scripts. Dumb. Bad. 1.) All non-FE scripts are crap. 2.) FE scripts work with non-FE games. CootKitty 311 — 6y
0
Also you asked this before. Bad. CootKitty 311 — 6y

Answer this question