Hello,
I am trying to make a model move when you select it and then click on a position. The model will then move to that position. However nothing happens when I try to move the model. I am a beginner coder I am not very good.
The goal is to create a soldier in which I can click, then click on another position and then it moves to the new position.
local Mouse = game.Players.LocalPlayer:Getmouse()
Unit = LocalScript.parent
NewPosition = Mouse.Hit.p --Clicking on new position
Unit.ClickDetector.MouseClick:connect(function (NewPosition) --Person clicks on Model
repeat
wait(1) --waits until they click on new position
until Mouse.Button1down == true
Unit:Moveto (NewPosition) --Move model to new position
end)
Thank you for time, hello3396

2 comments
There is a few things wrong with this at first glance. Is this script in the click detector?
Any errors?