Need Alternatives To Using ClickDetectors For Detecting Mouse Hovers On 3D Objects

I am making my own custom proximity prompt… kinda. Instead of the proximity prompt showing went approaching it, it shows up when hovering over its parent part. The script is working completely fine other than the annoying custom icon that shows up when you do hover over the clickdetector. I am wondering, is there a way to detect a mouse hovering over a 3D object besides click detectors? I considered mouse.target but i’ve heard it didnt work when moving your camera (moving camera might make your mouse move onto the part but mouse.target wont detect) Any help will be appreciated

3 Likes

You could do a quick loop or Heartbeat with Mouse.Target to constantly update it instead of only when the mouse moves.

1 Like

I will consider it but i try to only use heartbeat/infinite quick loops when theres no other option because of the unnecessary lag they cause

1 Like

You can always have a longer task.wait() if you feel like lag will be a big issue.

i just use the mouse.Move event

Mouse.Move doesn’t update when the camera moves, and he already stated thats what he needs.

Bind a raycast function to renderstep. Use the FilteringDescendants property to choose the parts you want it to detect

local param = RaycastParams.new()
param.FilterType = Enum.RaycastFilterType.Whitelist
param.FilterDescendantsInstances = {workspace} --customize this

local mouse = game:GetService('Players').LocalPlayer:GetMouse()

game:GetService('RunService').RenderStepped:Connect(function()
	local origin = workspace.CurrentCamera.CFrame.Position
	local ray = workspace:Raycast(origin, (mouse.Hit.Position - origin) * 1.1, param)
	if ray then
		--do stuff with ray.Instance
		print(ray.Instance)
	end
end)
1 Like

thanks, im going to try this out in roblox studio when i got time

1 Like