local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local toggle = false
mouse.KeyDown:connect(function(key)
if not toggle and key == "r" then
local i = Instance.new("Part",workspace)
i.Size = Vector3.new(14.53, 11.41, 1.59)
i.Anchored = true
while true do
wait()
i.Position = mouse.Hit.Position
end
end
end)
✓ ANSWER ACCEPTED
how do i fix when a mouse moving a part that part dose not com up at screen?
1 answer
✓ Accepted answer
1.) KeyDown is deprecated, use UserInputService or ContextActionService.
2.) The way mouse.Hit is calculated is with a ray, which is the UnitRay property, and gets the position where the ray and a BasePart instersect. This is why the part comes up to your camera. Your solution is to set the Mouse's TargetFilter to the part you want to move.
mouse.TargetFilter = i
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank YOU!!!!!!!