So I have ammo on the ground I want the player to be able to pick up. I also want a hitbox appear around the bullet when the player hovers over it. The problem is, this is a FPS game and the player is holding a tool 90% of the time. Click detectors do not work when a player is holding a tool. Is there a workaround to this that I could use?
Maybe proximity prompts? (30aaaa)
The problem is that I specifically want a mouse hover effect for the object.
If the player will be holding a tool 90% of the time like you said, they will not be able to click anything, that’s why @spydercam500 idea is the best option…you would need a mouse cursor for a mouse hover effect…
or, you can use the ClickDetector.MouseHoverEnter
to check whenever a player hovers on a click detector, which then you will add a selection box and then parent it to the model, then check when ClickDetector.MouseHoverLeave
is triggered and delete the selection box.
example code if you need it:
--this script must be server script and parented to the model, but you can always modify it
local item = script.Parent
local click = script.Parent:WaitForChild("ClickDetector")
click.MouseHoverEnter:Connect(function(player) --gets the player who hovers
local selectionbox = Instance.new("SelectionBox")
selectionbox.Parent = item
end)
click.MouseHoverLeave:Connect(function(player)
local selectionbox = item:FindFirstChildOfClass("SelectionBox")
if selectionbox then -- basically checks if it even exist
selectionbox:Destroy()
end
end)
if you want the same effect but only shows the outline to the player who is hovering and not reflect to the server, you could always use a remote event and handle the Instance.new()
and then selectionbox:Destroy()
inside a local script whenever the specific player receives the remote.
You could make a system to where when you hover over the ammo a proximity promt comes up