i want to do an action when mouse target is the parts that is in the folder and for some reason its not working
![]()

its printing the else part:
![]()

i want to do an action when mouse target is the parts that is in the folder and for some reason its not working
![]()

its printing the else part:
![]()

You should get the parent rather than… actually I’m not sure what that is you tried doing.
You can’t compare string to array you should use for loop.
i have tried to do that its not worked either
![]()

Instead of doing
if mouse.Target.Name == PartsFolder:GetChildren().Name then
You should do:
for i, v in pairs(PartsFolder:GetChildren()) do
if mouse.Target.Parent == v.Parent then -- Parent would be better. You never know
--when something might have the same name.
-- do what you want to do here
end
end
If this hasn’t worked, try printing out Mouse.Targert.Name
Use this instead:
local function isValidPart()
for _, child in pairs(PartsFolder:GetChildren()) do
if mouse.Target.Name == child.Name then
return true
end
end
return false
end
if isValidPart() then
--do stuff
end
if Mouse.Target then -- Check if the Target Actually Exists
if Mouse.Target:IsDecendantOf(PartsFolder) then
-- The Part is inside the folder and was clicked
-- do what you want to do with the part
end
end