You are correct so far; what you want to do next is connect to the Button1Down event:
local tool = script.Parent
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
end)
end)
For making other players walk away, iterate through each other player in the game and call Humanoid:MoveTo to tell them to walk:
local tool = script.Parent
local player=game.Players.LocalPlayer
local radius=30
local t=player.Character:WaitForChild("Torso")
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
for _,v in pairs(game.Players:GetPlayers())do
if v~=player and v.Character then
local char=v.Character
if char:FindFirsrtChild("Torso")and char:FindFirstChild("Humanoid")then
local torso,h=char.Torso,char.Humanoid
if(torso.Position-t.Position).magnitude<=radius then
h:MoveTo(torso.Position+CFrame.new(t.Position, torso.Position).lookVector*radius,t)
end
end
end
end
end)
end)
7 comments
And what would I use to confuse ( make them move away from the person that clicked it) players.
clicked what?
The tool
so whenever someone clicks, every other player in the game starts walking directly away from them?
Well I guess everyother player in a certain radius
Iterate through every other player, check if they're within the radius, use Humanoid:MoveTo to make them walk to some point.
I've never used that before. Can you give me an example?