Touched On A Model

When I do this it will work because its a part

local part = script.Parent
part.Touched

but when I do it with a model it doesnt

local model = script.Parent
model.Touched

does anyone know what the problem is

2 Likes

What’s stopping you is that models don’t have a lot of events, including the .Touched event. So there are two ways I can see you achieving this:

  1. For loop through all the model’s children and connect the .Touched event for each.
    Example:
local Model = workspace.Model

for _, child in ipairs(Model:GetChildren()) do --can also use :GetDescendants().
    if child:IsA("BasePart") then --to prevent errors
        child.Touched:Connect(function() -- connect the event to that child

        end
    end
end
  1. You can create some kind of a hitbox for that model and then connecting .Touched event to that hitbox.
    Example:
local Hitbox = workspace.ModelHitbox

Hitbox.Touched:Connect(function()

end)

Hope this helped! It seems like you’re new so I should also tell you to put the server script in ServerScriptStorage.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.