Looping through every ui in Starter Gui

Hello! I am trying to create a auto ui animatior and I can’t see to find a way to loop through every ui object in Starter Gui. The main problem is going through the children of ever object. If you have any solution please let me know!

for index, gui in pairs(player.PlayerGui:GetDescendants()) do
    -- do whatever
end

Never loop through StarterGui as it does nothing, go through the players PlayerGui

2 Likes

Would this be in a local script?

If you want it to happen to everyone on server you can either use remote events or playeradded because it returns a player or loop through game:GetService("Players"):GetPlayers()

if you wanna do it on the client use local player = game:GetService("Players").LocalPlayer

1 Like

You can use this in both. It depends of what you want to do or how you want to get the player.

2 Likes

script means for all player
local script means for just the player

2 Likes

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