Item moving issues

Hey So i recently made a script which would allow you to go up to a object press e and move it around. And as well make it work on the server. So There is a few issues and bugs which i think i need fixing before i go and release some sort of moving mechanic. Here’s the code that i think seems to be the issue

Scripts
--SERVER SCRIPT
Event.OnServerInvoke = function(player, item, PosValue, Mouse)	
	item.Position = Vector3.new(Mouse.Target)
end
--LOCAL SCRIPT
	local PosValue = item:FindFirstChild("Pos")
	if PosValue then
		Mouse.Button1Down:Connect(function(MovePart)

            Place:InvokeServer(item, PosValue, Mouse)
		end)
	else
		print("Missing pos value")
	end
--PLACING SCRIPT

Event.OnServerInvoke = function(player, item, PosValue, Mouse)	
	item.Position = Vector3.new(Mouse.Target)
end

And heres the screenshots
(Before picking up)
image
(when you pick it up)
image
For some odd reason whenever i stop moving my mouse the GameCube seems to disappear.
And with placing I haven’t got my mind round to doing that yet but there is issues with that as well.

I’m trying to use Mouse.TargetSurface to stop the item from clipping into the floor, as well with placing I cant place the item without it teleporting back to spawn. i assume that its because i made it teleport to the item Hologram which is just a cloned version of it but the Transparency is lower. And one more issue. The Item dissapearing from when the player stops moving their mouse, This does confuse me as the code which makes the item follow the players mouse seems correct in my eyes

Mouse.Move:Connect(function()
    local MousePos = Mouse.Hit.p
	
    MovePart.CFrame = CFrame.new(MousePos)
end)

Sorry for making a essay on this, But its just minor issues that I’d like fixing.

I really dont think i explained it the best. But in short the issues that i need to fix are:

Item clipping through floor, Im trying to use Mouse.TargetSurface to fix it
Item Disappearing when player’s mouse is idle
Placing system (as a whole)

bruh why do i always get ignored ;c

Have you searched for the solution on devhub and the dev forums?

Here is one I found similar to yours with the clipping into the floor:

There is also a tutorial on a placement system here which has the maths and scripting together on this common type of system.

1 Like

Ok, Ill have a look into it and see if i can do much, I since have deleted my code so ill rescript and fix a few of my other bugs on the way