Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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()

1 comment

0

I know this, so its already in my scripts.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.