Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help debugging this script, It only works in my studio, not in servers?

Asked by 8 years ago
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()



1 answer

Log in to vote
0
Answered by 8 years ago

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()
0
Didn't really work... buoyantair 123 — 8y
0
txt and info say script.Parent, try changing that too LifeInDevelopment 364 — 8y
0
I have changed them all buoyantair 123 — 8y
Ad

Answer this question