The code below is when the mouse is clicked it will clone that part at the mouses position. But I need help to make a X,Y,Z for a while loop that moves the part to the mouses position, specifically, how to make a Z axis for the Model.
local Part =game.Workspace.Model
playerMouse = game.Players.LocalPlayer:GetMouse()
playerMouse.Button1Down:connect(function(Hit)
local Part2 = Part:Clone()
Part2.Parent = game.Workspace
Part2:MakeJoints()
local x = playerMouse.Hit.X
local y = playerMouse.Hit.Y
local z = playerMouse.Hit.Z
Part:MoveTo(Vector3.new(x,y,z))
end)
