Hello friends. I am making a placement system and I have found myself stuck at a little problem. When placing the object, I need to check the mouse's target is a panel from the base. Anyways, for this, I need to use mouse.Target. But the problem with doing this is that the mouse's target will always be the part I'm dragging. I've tried things to kind of "whitelist" the part from being detected such as making the part locked. This hasn't worked and I was wondering if anybody had a solution to my problem.
This is the code for the problem: (This is just a piece of the code. All variables are defined.)
local assets = replicatedStorage.CoreModule.Assets
local clone = assets.Placeable:FindFirstChild(object.Name)
local placeEvent = replicatedStorage.CoreModule.Events.BuyBuild
if clone then
local panel
print(mouse.Target.Name)
if mouse.Target and mouse.Target.Name:find("Panel") then
local base = mouse.Target.Parent.Parent
if base and base.Name:find("Base") then
print'oh base yes'
local config = base:FindFirstChild("Configuration")
if config and config:FindFirstChild("Owner") then
if config.Owner.Value.Name == player.Name then
panel = mouse.Target
else
panel = "CannotPlace"
end
end
end
end

4 comments
I tried that for the model not the part it's self. I'll try it.
It doesn't work.
oh crap. I wasn't using the object that was on the players mouse as the target filter.
Glad I could help :) Also, I really don't like to ask but could you upvote me please, if it's not a bother? I really want and am really close to get to the next reputation rank.