Please help i dont understand why it doesnt work

script.Parent.MouseButton1Click:Connect(function()
script.Parent:Destroy()
script.Parent.Parent.LoadingScreen.Visible = true
end)
THIS SCRIPT IS LITERALLY NOT WORKING LIKE ITS SO SIMPLE THERES NO REASON FOR IT TO NOT WORK, IT DESTROYS THE PARENT OF THE SCRIPT AND MAKES THE LOADINGSCREEN VISIBLE BUT ITS NOT WORKING I PLEASE HLEP I AM VERY NMAD

This is most likely because you destroy the script’s parent and then search for an object through the script’s parent (which is now nil). You can solve this by saving the script’s parent or first getting the loading screen and then destroying the script.

local ParentObject = script.Parent
ParentObject.MouseButton1Click:Connect(function()
   ParentObject.Parent.LoadingScreen.Visible = true
   ParentObject:Destroy()
end)
2 Likes

You are destroying the Parent of the script and then callounf it’s Parent again, that doesn’t work, try:

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.LoadingScreen.Visible = true
script.Parent:Destroy()
end)
2 Likes

i fixed it so dont respond hehe

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.