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

How to make a npc move to your cursors location?

Asked by 3 years ago

Ive been trying to make a game and it involves npcs moving to the press of my mouse now i already know the location of my mouse as i put this is starterpack local LocalPlayer = game.Players.LocalPlayer local mouse = LocalPlayer:GetMouse() mouse.KeyDown:Connect(function(key) print(key) end) mouse.Button1Down:Connect(function() print(tostring(mouse.Target.Name)..""..tostring(mouse.Hit.Position)) end) but i dont know how to use the location of the press to move the npc to that location can anyone help me?

0
please format your code. you can do this by selecting your code, then pressing the "lua" icon User#30567 0 — 3y
0
you can use the `Humanoid:MoveTo` function to move any character to a location. for more information go to the api reference User#30567 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

This is on a localscript which means it will not show up for other people. Try using a regular script inside of the tool and firing a remoteevent to a localscript which would return a remote event to the script with the mouse.hit.p attatched. also, use Humanoid:MoveTo()

Ad

Answer this question