I'm making a while loop that will move the part to the mouse always, so I can create a building system.
--Variables local player = game.Players.LocalPlayer local mouse = player:GetMouse() local Part = game.Workspace.Farm:Clone() Part.Parent = game.Workspace --Move Part to Mouse Position Always while true do local x = mouse.X local y = mouse.Y Part.Position = Vector3.new(x,y) --Places Part at Mouse Position. mouse.Button1Down:connect(function(hit) local X = mouse.hit.X local Y = mouse.hit.Y local Z = mouse.hit.Z local Partt = Part:Clone() Partt.Parent = game.Workspace Partt.Anchored = true Partt.Position = Vector3.new(X,Y,Z) wait(5) Partt:Destroy() end) wait() end
Well, the simple answer is no. Since Z would only exist on a 3D space. Unfortunately for mouse it exists on a two value plane. AKA X and Y which would both represent the position of the mouse on a 2D screen.