Good day all,
I’m having a bit of difficulty with some code I’m writing at the moment.
PROBLEM
The line in the function below, “game.ServerStorage:WaitForChild(“UI_Elements”)… …PlayerGui)” isn’t executing properly because “UI_Elements” isn’t a child of ServerStorage. I’ve already checked that it’s viewable on the server-side, but for whatever reason, fails to be detected by this server-side script.
function Send_To_Main_Menu()
Fade("White", 0.25, 0)
Player.Character:Destroy()
for _, element in pairs (Heads_Up_Display.Statistics:GetDescendants()) do
element.Visible = false
end
Main_Menu_Button.Visible = false
game.ServerStorage:WaitForChild("UI_Elements").Main_Menu:Clone(Player.PlayerGui)
Fade("White", 0.25, 1)
Heads_Up_Display:Destroy()
end
Can anyone help me out here? I reckon it’s probably something incredibly stupid I’ve missed the 5 times I’ve looked over this line of code but I can’t for the life of me figure this one out.
I had the same issue a while ago, you’d typically put those folders into ReplicatedStorage other than ServerStorage
EDIT:
By using the wiki, I discovered that you can’t see it from the client. That’s why you would use ReplicatedStorage. ServerStorage | Documentation - Roblox Creator Hub
It says " A container whose contents are only accessible on the server. Objects descending from ServerStorage will not replicate to the client and will not be accessible from LocalScript s."
Uhh, some confusion going on here.
Turns out I was wrong to think ServerStorage was able to be accessed by a client.
Oh, and the script ended up being a local script. I’ve got a remoteinstance_management_script open so I must’ve gotten confused. Thanks.