Hi,
I have this script in the game I teleport people to from my main game, that loads all the assets in via a loading screen. For some reason, when someone teleports, this script breaks.
Script (not full):
local Assets = Workspace:GetDescendants()
script.Parent.Enabled = true
for i = 1, #Assets do
local asset = Assets[i]
local percentage = math.round(i / #Assets * 100)
ContentProvider:PreloadAsync({asset})
Background:WaitForChild("DisplayPercentage").Text = percentage.."%"
Background:WaitForChild("AssetsLoaded").Text = "Loading Assets: "..i.."/"..#Assets
TweenService:Create(Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play()
if i % 50 == 0 then
task.wait()
end
end
Any help would be appreciated, thanks!