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

How do i fix load problems(animations and textures)?

Asked by 6 years ago

Ive noticed that roblox doesnt always load in everything. I have a texture that loads, but then halfway through playing the game, the texture fails to load in on some objects. Also, i have an animation that is supposed to be used on the character, but that fails to load too. What am i supposed to do???

2 answers

Log in to vote
0
Answered by 6 years ago

It's most likely because, your script is moving faster than the amount of time for your animation and decal to load. This can be worked by using a sort of waiting sytem. Not wait() but, things like:

:WaitForChild()

or, what I mostly use is,

repeat wait() until blah blah blah == true (you don't have to use blah blah blah)

here's an example.

Local party = script.Parent
function re()
    while true do
        print(party.Name)
    end
end

re()

^^ this may or may not fail but, if it does then you could do

Local party = script.Parent
function re()
    repeat wait() until party -- This will make it so that the code won't run unless party is true.
        while party do
            print(party.Name)
        end
end
re()

You can also do

Local party = script.Parent
function re()
game:WaitForChild("Party")
        while true do
            print(party.Name)
        end
end

re()

or

Local party = script.Parent

function re()
game.FindFirstChild("party")
    if party then 
        while true do
            print(party.Name)
        end
    end
end
re()
0
I know this, so its already in my scripts. User#19492 0 — 6y
Ad
Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
6 years ago
Edited 6 years ago

When it comes to loading things such as decals and animations, you can use the ContentProvider service. This service has a function called PreloadAsync() that you can use to load in your animations.

local animTrack = --animation
local decal = --something
local cp = game:GetService("ContentProvider")

--The decal above should be an instance and
--not an id

cp:PreloadAsync(animTrack)
cp:PreloadAsync(decal)

--Animation and decal are loaded

The PreloadAsync() function also goes through all the descendants of an object which is useful for loading large amounts of assets at a time.

Answer this question