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
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
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:
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
.Touched
event to that hitbox.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.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.