I'm trying to make a gomba but I got an error. It says "Touched is not a valid member of script." Heres the script:

             for key, object in pairs(script.Parent:GetChildren()) do
if object:IsA("Part") or object:IsA("MeshPart") then
end
object.Touched:Connect(damage) --Where I recieved the error.

end

3 comments

0

you forgot to add function after connect it should be: object.Touched:Connect(function(damage)

0

Ohh, I didn't realize that! I'll try that and see if it works. Thanks!

0

It worked! Thank you!