Hello. I’m currently trying to make a part destroy itself whenever it touches something but my script wont work. I’ve tried putting the function call inside an if statement and added print statements to see where it fails but nothing happens.
The weird part about it is that the script only fails if another script has cloned the part it’s in into the workspace. Whenever it put the part into the workspace manually it works just fine.
local Part = script.Parent
local function ontouch()
print("Part Touched!")
wait(1.5)
script.Parent:Destroy()
print("Part Destroyed!")
end
if script.Parent.Parent == game.Workspace then
Part.Touched:Connect(ontouch)
end
No, it’s just a normal “Script”. It is cloned into the workspace with a LocalScript though, but i don’t see any way that could affect this script as that works just fine.
@DapperTheGreen
It is cloned into the workspace with a LocalScript though, but i don’t see any way that could affect this script as that works just fine?