Irregular asset behaviour

Here’s what I’m doing:

I have about 17 decal layered on top of eachother (inefficient, I know! But the assets has a delay before loading in everytime so it’s even worse of a delay).

Here’s the script I use for it.

while true do
	--script.Parent.Texture = ids[counter];
	--script.Parent.Parent.Decal2.Texture = ids[counter];
	script.Parent.slash:GetChildren()[counter].Transparency = 0;
	for index, decal in pairs(script.Parent.slash:GetChildren()) do
		if index ~= counter then
			decal.Transparency = 1;
	counter = counter + 1;
	if counter > 17 then
		counter = 1

The slash is a part thats parented to workspace. Inside the part is 17 decals, each with a frame of the slash animation. The code simply loops through it 18 times, enabling and disabling the transparency of the decal to run through the frames. As you can notice, however, it sometimes disappears and sometimes runs smoothly. Anyone knows how to fix this? Or a better way?

1 Like

Make sure you’re preloading the decals/textures beforehand.

Also, instead of doing that (layering) you can just utilize texture offsets, beams, trails, or crescent meshes with textures applied to them.

Any of those would work fine ^

Also, maybe the issue is this?

if counter > 17 then -- change to counter >= 17?
		counter = 1

The reason why I didn’t go with trails is because the effects ultilizes spritesheets, and as far as I’m aware, decals are the best way to go about it.
I planned to use a mesh too, but I’m terribly unknowledgable in the VFX department. If you can elaborate, it’ll be great :smiley:
As for the preloading, I tried to preload them but it just yields my script forever.