so i made a simple script that when u press a button, it creates a ball part, makes a simple outline by cloning the ball, changing the size, making it translucent, and grabs both of those parts, puts it in a model and welds them together, then puts the script below into the main part, what its supposed to do, is check if the part that touched the ball is called destroy, if it is it destroys the ball model and all the children inside, but for some reason its not working, can anyone help?
script.Parent.Touched:Connect(function(hit) -- checks what the ball part clone has touched if hit.Name == "Destroy" then -- checks if the part it touched is named destroy script.Parent.Parent:Destroy() -- destroys the ball clone model end end)
Try using print("Test")
to find the error
here try running this and what doesn't print is what is not working. Make sure you have output open
print("Test") script.Parent.Touched:Connect(function(hit) -- checks what the ball part clone has touched print("Touched") if hit.Name == "Destroy" then -- checks if the part it touched is named destroy print("if") script.Parent.Parent:Destroy() -- destroys the ball clone model print("shouldwork") end end)
Hope this finds the error let me know where the error is if you need help