So i have been struggling with this for the past 3 hours trying to figure out why it is not working but i did not i thought it was my game that was the issue so i went to a clean baseplate and tried to see if it is my games issue but i got the same error from my other so i came here seeking some help on how to fix this big or error
Hi so I tried it out and at first it error so I tried a different method which is this:
local Models = script.Parent
for i, v in Models:GetDescendants() do
if v:IsA("Part") then
v.Touched:Connect(function(Hit)
print(Hit.Parent)
end)
end
end
Check if the player had touched them, .Touched events only work with physics(so anchored and anchored parts wouldn’t work), you would need to use :GetTouchingParts()
Try something like this:
local Models = script.Parent
for i, v in Models:GetDescendants() do
if v:IsA("Part") then
v.Touched:Connect(function(Hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
print(Hit.Parent)
end
end)
end
end
or
local Parts = script.Parent:GetDescendants()
for i,v in Parts do
if v:IsA("BasePart") then
local PartsTouching = v:GetTouchingParts()
for i,v in PartsTouching do
print(v.Name)
end
end
end