The path that condition
uses to find the AttachmentButton will error if any of those Instances aren’t loaded by the client yet. You can WaitForChild each of the trailing descendants from PlayerGui until you reach AttachmentButton. If you do this, you do not need to wait for the LocalPlayer property or its PlayerGui child to exist.
If the ScreenGui has ResetOnSpawn set to true, this code will not “stop doing stuff” when the player dies and their GUI is reset. This might cause invalid state in your experience.
Less important: Some pedant (me) would recommend you game:GetService()
the Players service instead of directly indexing it. The == true
is redundant in an if statement.
okay, so just minor things, thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.