Inside of a local script in a hopperbin.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
if script.Parent.Main.Disabled == true then
script.Parent.Main.Disabled = false
local ghost = Instance.new("Part", game.Workspace)
ghost.Name = "Ghost"
ghost.Anchored = true
ghost.Size = Vector3.new(4,4,4)
ghost.Color = Color3.new(20,50,100)
ghost.Transparency = 0.5
ghost.CanCollide = true
while true do
wait(0.05)
ghost.Position = Vector3.new(math.floor(mouse.hit.x / 1), math.floor(mouse.hit.y / 1) , math.floor(mouse.hit.z / 1))
end
When I am using this to make a cube follow my mouse the cube keeps going up, I have removed the CFrame value for y and replaced it with a 0, that works but it messes up because it ends up in the ground (because it is CanCollided) But if I set CanCollide to false then it messes up the other script in the hopper bin(Doesn't break it, just makes the output of that script turn out the wrong way)

2 comments
Is it only moving up? From that code it looks like it should be quickly moving towards the camera rather then just up.
Well, it is going towards the camera but it is up.. Not up in a straight line though. Is there a different way to do this?