here is the code
if m.Hit == nil then return end if m.Hit.p == nil then return end if m.Target == nil then return end if m.Target.Parent == nil then return end local Hit = m.Hit.p local Target = m.Target if ((((Hit) - (game.Players.LocalPlayer.Character:findFirstChild("Torso").Position)).magnitude)<=50) then game.Players.LocalPlayer.Character:findFirstChild("Humanoid"):MoveTo(Hit,Target) end end
I've been thinking about tweaking
local m = game.Players.LocalPlayer:GetMouse() m.Button1Down:connect(function() onButton1Down(m) end) function onButton1Down(m)
But, I just want to make sure it'd be the right thing to do... Any advice?
When you call the function with the event of "Button1Down"
m.Button1Down:connect(function() onButton1Down(m) end)
By changing
m.Button1Down
to
m.Button2Down
The event will be fired with right click.