I was wondering if anybody could help me with a project I’m trying to complete at the moment. I’m using :GetChildren() but am getting an error I’ve not really come across before. It’s been a while since I’ve programmed using this method and can’t work out why I’m getting this error!
Any help would be appreciated.
local ProductsFolder = game.ServerStorage:WaitForChild("UIProducts", 5)
local Products = ProductsFolder:GetChildren()
Adding on to @Quwanterz, if you want to “access” ServerStorage from localscripts, you can use remotes to go to a server script.
Server scripts can access ServerStorage (Hence the name, you know?)
What you can do is create a remote event that will power the serverstorage, and callback all children to the localscript.
Example Code:
Local Script:
game.ReplicatedStorage.RemoteEvent:FireServer()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(Products)
-- function
end)
Server Script:
local ProductsFolder = game.ServerStorage:WaitForChild("UIProducts", 5)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
local Products = ProductsFolder:GetChildren()
game.ReplicatedStorage.RemoteEvent:FireAllClients(Products)
-- or if you want it to be that one player, do game.ReplicatedStorage.RemoteEvent:FireClient(plr, Products)
end)