local barhold = script.Parent.loadingFrame local bar = barhold.loadingBar local screen = script.Parent local txt = script.Parent.Text local info = script.Parent:WaitForChild("info") local loaded = 0 _G.soundassets = {164508682, 176135621, 200907510, 142402325, 190547014, 197321696, 165937331, 198507773, 163611921, 165065112, 187768662, 243171299, 243171064, 243170995, 243170853, 173607522, 173607581, 173607688, 173607557, 173600950, } cp = game:GetService("ContentProvider") sss = game:GetService("ServerScriptService") ui = require(sss:WaitForChild('UIManipulator')) ui.Fade(barhold, "In", .1) ui.Fade(bar, "In", .1) info.Visible = true for _, AssetId in pairs(_G.soundassets) do cp:Preload("http://www.roblox.com/asset/?id=" .. AssetId) loaded = loaded +1 info.Text = "Loading asset: "..AssetId.." || "..loaded.." Out of "..#_G.soundassets bar:TweenSize(UDim2.new(loaded/#_G.soundassets, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint) wait(1) end info.Visible = false bar:TweenSize(UDim2.new(0,0,1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1) wait(1) ui.Fade(bar, "Out", .1) ui.Fade(barhold, "Out", .1) ui.Fade(screen, "Out", .1) screen.Parent:Destroy()
It's because all the variables you are declaring are not in the player's gui environment and mabye it has something to do with filtering enabled.
It should be:
local player = game.Players.LocalPlayer local barhold = script.Parent.loadingFrame -- now declare your variables like player.PlayerGui.YourScreenGui.YourLoadingFrame local bar = barhold.loadingBar local screen = script.Parent local txt = script.Parent.Text local info = script.Parent:WaitForChild("info") local loaded = 0 _G.soundassets = {164508682, 176135621, 200907510, 142402325, 190547014, 197321696, 165937331, 198507773, 163611921, 165065112, 187768662, 243171299, 243171064, 243170995, 243170853, 173607522, 173607581, 173607688, 173607557, 173600950, } cp = game:GetService("ContentProvider") sss = game:GetService("ServerScriptService") ui = require(sss:WaitForChild('UIManipulator')) ui.Fade(barhold, "In", .1) ui.Fade(bar, "In", .1) info.Visible = true for _, AssetId in pairs(_G.soundassets) do cp:Preload("http://www.roblox.com/asset/?id=" .. AssetId) loaded = loaded +1 info.Text = "Loading asset: "..AssetId.." || "..loaded.." Out of "..#_G.soundassets bar:TweenSize(UDim2.new(loaded/#_G.soundassets, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint) wait(1) end info.Visible = false bar:TweenSize(UDim2.new(0,0,1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1) wait(1) ui.Fade(bar, "Out", .1) ui.Fade(barhold, "Out", .1) ui.Fade(screen, "Out", .1) screen.Parent:Destroy()