Block is just a normal part, which i think it’s a BasePart, here i will send a screenshot of the explorer, i hope this help:
Script is handling the code with the current error.
Block is just a normal part, which i think it’s a BasePart, here i will send a screenshot of the explorer, i hope this help:
Script is handling the code with the current error.
Oh, you should still check if Block
is a BasePart because the script is a child of the model and you’re trying to hook up the Touched event to a non-BasePart.
local model = workspace.Model:GetChildren()
for _, part in pairs(model) do
if part:IsA("BasePart") then
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)
end
end
Models can’t be touched, only parts. Grouping by model is smart, so assign the part you want to activate the function as the PrimaryPart. Then do:
Model.PrimaryPart.Touched:Connect(func)