I already have the moving part of the script but now I need to make the part snap to grid which the part in this case target:
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local target = nil local down = nil local plr = game.Players.LocalPlayer function gettarget() if mouse.Target ~= nil then if mouse.Target.Parent == game.Workspace[plr.Name .. "w"] then target = mouse.Target mouse.TargetFilter = target down = true end end end mouse.Button1Down:connect(gettarget) function move() if down == true then if target ~= nil then local PosX,PosY,PosZ = mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z target.Position = Vector3.new(PosX,PosY,PosZ) end end end mouse.Move:connect(move) function releasetarget() down = false target = nil mouse.TargetFilter = nil end mouse.Button1Up:connect(releasetarget)
Also could you please explain to me how the snapping works?
Closed as Not Constructive by Goulstem
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?