공부/Roblox Studio
[로블록스 스튜디오] 오류 없이 script를 가진 parent 삭제하기 / transform function error script that implemented this callback has been destroyed while calling callback
굴러다니다니
2023. 10. 20. 13:49
728x90
대충 모델을 클릭하면 모델의 자식인 ClickDetector가 이를 파악하고, Descendant에 있는 Script가 script.Parent:Destroy()하는 식을 썼는데
위와 같은 오류가 발생하였다.
이를 Debris를 사용해 삭제하면 오류가 나지 않고 삭제할 수 있다
local debris = game:GetService("Debris")
script.Parent.ClickDetector.MouseClick:Connect(function(player)
debris:AddItem(script.parent, 1)
script.Parent:Destroy()
end)
728x90