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)
(when you pick it up)
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.