Well, I made a pretty good collection system for my game, basically use E to grab, use and interact. Moreover, when the players hover their mouse on the thing, it will be highlighted (with outlines).
But I got some problems with this, I figured out that we cannot use clickDetector, for click event or hover event when holding a tool, the hightlight system just breaks when holding a tool.
I read some posts and it seems like the only way to solve this is to not using “Tool” anymore, instead welding it to the player hand or something like that. To conclude, I want some ideas on how to do this, like how to keep the tool grip, and the Handle is still inside the character because my system need it.
Edit: mouseClick is not my problem as i used E and mouse.target instead of clicking.
Edit 2: I found some posts on how to do this, i’m currently on mobile so i will try them tomorrow. I will leave the link to the posts if it worked.
Well, i used a local script to handle hightlight things. Basically it will find all clickDetector and then make a function on mouseHover events. But these events wont trigger when the player is holding a tool
That’s a pretty bad method. Because inside every part there’s a click detector. Instead I recommend trying to use mouse.Target instead. And like @Forummer said you should try using mouse.TargetFilter too. Basically how it would work is you use you RunService to update the highlight. It would look like this:
local RunService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
RunService.RenderStepped:Connect(function() -- You could also make a seperate function
if mouse.Target and not mouse.Target:FindFirstAncestorOfClass("Tool") then
-- Parent highlight to traget
end
end)
Also you shouldn’t create a highlight every time instead just parent it to the updated object.
But also if you have a model of all the parts then use mouse.TargetFilter.
Oops, thanks for your help and sorry because I forgot to update the post, I used no tool equipment now (it is an accessory that weld to player hand). Because I’d like to tween the highlight too.