Hello scripters.
I am getting nil when trying to put a folder under a variable. How can i fix this?
setup:
script:
local soundfolder = gui.Soundregions.Businessmusic
Edit: forgot to add console output
Hello scripters.
I am getting nil when trying to put a folder under a variable. How can i fix this?
setup:
script:
local soundfolder = gui.Soundregions.Businessmusic
Edit: forgot to add console output
gui is a correct variable to the players gui. The folder is still there when the game is running.
Referencing it too early before the characters been loaded maybe? Try doing:
local gui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local soundfolder = gui:WaitForChild("Soundregions").Businessmusic
instead so the thread yields until it can see it’s there.
Thank you for your help. 1 am scripting causes me to have less brain cells.