Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script Wont Destroy Clone Model When Touching A Specific Part?

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)

1 comment

0

also i already done the cloning script and stuff so dont worry about that

1 answer

✓ Accepted answer

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

2 comments

0

i tried this and none of the prints worked, so i went into the main cloning script and found the error, thx

0

Your welcome!!

This discussion is preserved as it was. New answers, comments, and votes are closed.