Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i fix when a mouse moving a part that part dose not com up at screen?

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)

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

1 comment

0

Thank YOU!!!!!!!

This discussion is preserved as it was. New answers, comments, and votes are closed.