Why is my server-side script failing to find this folder in ServerStorage?

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

image

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.

Clone doesn’t take any arguments, you need to set the parent manually.

image

This has not fixed the issue.

…now it’s telling me DataModel (game) has no child ServerStorage.

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."

1 Like

Can you try game:GetService("ServerStorage") instead? Although I’m not sure why it would be renamed.

I would’ve said the same thing except OP said it was a server-side script.

2 Likes

I’m not sure if this has anything to do with your problem, but where’s the script located?

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.

2 Likes

A post was merged into an existing topic: Off-topic and bump posts

Mark as solution?