I am making a gun system and I got my first problem.
So the problem is that I want when the player clicks on a part that is in a model to print the model name instead of the part name!!
Here the code:
local eq = false
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
script.Parent.Equipped:Connect(function()
eq = true
end)
script.Parent.Unequipped:Connect(function()
eq = false
end)
mouse.Button1Down:Connect(function()
if eq == true then
local Target1 = mouse.Target
if Target1.ClassName == 'Part' then
print(Target1.Parent.Parent)
end
end
end)