Problem with my code

For some reason ive been trying to make this placement system. I was raycasting to see if it would collide with objects and stuff but for some reason the object never moves to the mouses position. Anyone know why?

								if placingobject == true then
									mouse.TargetFilter = previewobject
									if previewobject:FindFirstChild("MainPart") then
										local ignoreList = {game.Players.LocalPlayer.Character}
										if previewobject ~= nil then
											table.insert(ignoreList,previewobject)
										end
										local mouseRay = mouse.UnitRay
										local newRay = Ray.new(mouseRay.Origin, mouseRay.Direction.Unit * 35)
										target, pos, norm = workspace:FindPartOnRayWithIgnoreList(newRay, ignoreList)
									end
								else
									previewobject:Destroy()
								end
								if placingobject == false then
									script.Parent.Inventorybtn.Visible = true
									script.Parent.Rotation.Visible = false
								end
							end)
1 Like