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

Why doesn't this work?

Asked by 10 years ago

Hello... I am making a GUI that uses InsertService:LoadAsset() to load Gear. This is what the GUI looks like.

StarterGUI
      [ScreenGui] AssetGui
             [Frame] ASSETFRAME
            [TextButton] GetAsset
            [TextBox] IDAsset ( text box to put asset Id in )
            [TextLabel] Desc
            [TextLabel] Credit
            [Script] Loader:

---- HERE IS THE SOURCE FOR LOADER SCRIPT ----

 -- InternalSequence
gui = {
    assetId = script.Parent.IDAsset.Text;
    GetAsset = script.Parent.GetAsset.MouseButton1Click;
    stat = script.Parent.Desc;
 }
 function insert(id) -- OK.
    ser = game:GetService('InsertService')
    ser:LoadAsset(tonumber(id))
 end
 function show(parent,texttoshow,delay)
    m = Instance.new('Message', parent)
    m.Text = texttoshow
    wait(delay)
    m:Remove()
end
 script.Parent.GetAsset.MouseButton1Click:connect(function()
    if script.Parent.IDAsset.Text == "" then
        show(script.Parent.Parent.Parent, 'This is not a valid ID!', 5)
    else
        -- 'animation'
        script.Parent.GetAsset:Remove()
        script.Parent.IDAsset:Remove()
        script.Parent.credit:Remove()
        print ' removed all others before anim '
        --Y 0.15, -Y .25
        gui.stat.Text = '[ LOADING ASSET ]'
        print ' changed to [loading asset] '
        wait(0.2)
        --[[gui.stat.Position.Y.Scale = 0.200 this line is ugly and shall never be used]]--
        for i=1,7 do
            print ('for loop...animation DOWN... loop# '..i..'/7')
            game.StarterGui.AssetGui.ASSETFRAME.Desc.Position = UDim2.new(0.25, 0, game.StarterGui.AssetGui.ASSETFRAME.Desc.Position.Y.Scale+0.05 , 0)
            wait(0)
        end
        print ' before insert, after DOWN loop'
        insert(tonumber(gui.assetId));
        print ('[Note] assetId in gui looks like its '..gui.assetId)
        ser = game:GetService('InsertService')
        ser:LoadAsset(tonumber(gui.assetId))
        print 'done insert(tonumber(gui.assetId))'
        wait(2)
        print 'wait 2'
        for i = 1,7 do
            print('for loop... animation UP... loop# '..i..'/7')
            game.StarterGui.AssetGui.ASSETFRAME.Desc.Position=UDim2.new(0.25, 0, game.StarterGui.AssetGui.ASSETFRAME.Desc.Position.Y.Scale-0.05, 0)
            wait(0)
        end
        game.ServerStorage.AssetGui.GetAsset:Clone().Parent = script.Parent
        game.ServerStorage.AssetGui.IDAsset:Clone().Parent = script.Parent
        game.ServerStorage.AssetGui.credit:Clone().Parent = script.Parent
        print ' restoring others '
        gui.stat.Text = '[ ASSET ID: ]'
        print'changed back to [asset id]'
    end
 end)


0
Can you put it into codeblock instead? ultrabug 306 — 10y
0
Just did that InternalSequence 5 — 10y
0
Anyone >,,< InternalSequence 5 — 10y
0
I noticed this has nothing to do with Animations. Please don't mistag your question. Maxomega3 106 — 10y

Answer this question