I keep many of my assets, such as sounds, meshes, and animations in the ServerStorage so that it can be easily accessed by my server-sided scripts. I want all of these assets to be loaded for every player, but PreloadAsync is a client-sided function. Am I going to have to move all of my assets to the client in order to preload them? I'm worried about exploiters getting access to these assets if I put them in the client side. Here are my scripts: From the server:
game.Players.PlayerAdded:Connect(function(player) local assetsToLoad = game.ServerStorage:GetDescendants() game.ReplicatedStorage.LoadContent:FireClient(player, assetsToLoad) end)
From the client:
local ContentProvider = game:GetService("ContentProvider") game.ReplicatedStorage.LoadContent.OnClientEvent:Connect(function(assets) repeat wait() until script.Parent:FindFirstChild("Frame") ~= nil --Waiting for the gui to load assets = game.ServerStorage:GetDescendants() script.Parent.Frame.Visible = true for num, asset in pairs(assets) do script.Parent.Frame.TextLabel.Text = num .. "/" .. #assets ContentProvider:PreloadAsync({asset}) end for i = 0, 1, .1 do script.Parent.Frame.BackgroundTransparency = i script.Parent.Frame.TextLabel.TextTransparency = i wait() end script.Parent.Frame.Visible = false end)