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)

Reposted because nobody was answering and it got lost under everyone elses questions. Please make it compatible with games that have filtering disabled.

2 comments

0

yay duplicates

0

loop through all the players and compare how close they are to whoever has the tool. use magnitude.