Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script Wont Destroy Clone Model When Touching A Specific Part?

Asked by 1 year ago

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)
0
also i already done the cloning script and stuff so dont worry about that JmoneyPlayzOfficial 49 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago

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

0
i tried this and none of the prints worked, so i went into the main cloning script and found the error, thx JmoneyPlayzOfficial 49 — 1y
0
Your welcome!! theking66hayday 841 — 1y
Ad

Answer this question