Decals on meshes flicker

Hello!!

So i encountered a weird thing with decals, I can’t really explain it so i’ll let the video speak for itself:

So yeah for some reason if i delete or disable the script for 1 mesh, The other mesh will animate perfectly fine.

The code in the scripts:

local function PlayAnim(Enabled, Decal: Decal, Ids, Speed)
	if Enabled then
		for i = #Ids, 1, -1 do
			Decal.Texture = Ids[i]
			task.wait(1/Speed)
		end
		Decal.Texture = ""
	else
		for _, v in ipairs(Ids) do
			Decal.Texture = v
			task.wait(1/Speed)
		end
		Decal.Texture = ""
	end
end

local Ids = {
	"rbxassetid://75149694780766",
	"rbxassetid://126304879048227",
	"rbxassetid://118254653888699",
	"rbxassetid://135725714452150",
	"rbxassetid://139515914986650",
	"rbxassetid://125950383355882",
	"rbxassetid://131147775240934",
	"rbxassetid://115268953701514",
	"rbxassetid://111998248300825",
	"rbxassetid://136794560307342",
	"rbxassetid://86872189557951",
	"rbxassetid://104398786898137",
	"rbxassetid://119623648326056",
	"rbxassetid://92580307197485",
	"rbxassetid://115989060762318",
	"rbxassetid://70889991497696",
	"rbxassetid://82020057241462",
	"rbxassetid://94337560510952",
	"rbxassetid://121922488823445",
	"rbxassetid://122141523353127",
	"rbxassetid://127972682038423",
	"rbxassetid://127936714374528",
	"rbxassetid://83279233859024",
	"rbxassetid://138422763742143",
	"rbxassetid://121894841341942",
	"rbxassetid://135838405105266",
	"rbxassetid://105783849568458",
	"rbxassetid://140577601986382",
	"rbxassetid://107621436134571",
	"rbxassetid://100529985932956",
	"rbxassetid://97364691188034",
	"rbxassetid://78730275520292",
	"rbxassetid://111204200276177",
	"rbxassetid://110871002542674",
	"rbxassetid://78951240639361",
	"rbxassetid://128012542735285",
	"rbxassetid://100666843410719",
	"rbxassetid://121425204837659",
	"rbxassetid://95207060834254",
	"rbxassetid://140495748378432",
	"rbxassetid://125046298088658",
}

local Decal = script.Parent.Decal
local FlippedDecal = script.Parent.FlippedPillar.Decal

local Speed = 60

task.wait(2)

task.spawn(function()
	while true do
		PlayAnim(false, FlippedDecal, Ids, Speed)
	end
end)

task.spawn(function()
	while true do
		PlayAnim(false, Decal, Ids, Speed)
	end
end)

it works the same for the other mesh but just different “Ids”.

Solutions i’ve tried but didn’t do anything:

  • Deleting the flipped version of itself
  • Trying it in a new baseplate

Solutions i’ve tried and gave somewhat of a result:

  • Reducing the amount of ids in the “Ids” table. (But of course that didn’t look good whatsoever)
  • Making both meshes the same. (For some reason it didn’t flicker but i want both meshes duhh!)

Hierarchy:
RobloxStudioBeta_yR7exapDYz

Any help would be amazing :heart:

1 Like

Not enough to work with here … looks like you’re getting an overlap problem. My guess would be they are in the exact spot. Move one over and up by 0.01… If they are interfering with each other that should stop the overlap flicker.

2 Likes

Have you tried checking if all of the ids are valid?
You can try preloading all ids game:GetService("ContentProvider"):PreloadAsync(Ids)

Edit: also try removing these lines

1 Like

I did move them, check the video

yup all the ids are valid and working.
just removed that line u said to remove andddd it’s still flickering

Try adding this just after Ids table

still flickering unfortunately…

Do you have occlusion culling beta feature enabled?

oh yes i do, should i disable it?

1 Like

Try disabling it, occlusion culling is tend to do that atm

1 Like

aw man it’s still flickering :sad:
it’s definitely disabled, i even checked the wireframe view

I’ve no idea sadly, decals just don’t seem to load so I can’t really help :frowning:

1 Like

Its because roblox has to load the each decal once and there’s a delay so nothing appears in that moment.

yeah i know but no matter how long i wait it still flickers, unless i disable one of the scripts it’ll keep flickering.

Try changing one of the Decal’s ZIndex


If it doesn’t work, you could try rotating the part that the decal’s attached to. Doing so should save a bit of memory as well, since the engine would only need to store 1 (or 2) images/decals rather than 41


Alternatively, you could also use a SurfaceGui with an ImageLabel instead of using decals, and import each image as a texture atlas, which would then allow you to tween the ImageLabel’s ImageRectOffset to achieve the same effect

1 Like

1- Again it’s not an overlapping problem
2- I need it to be animated that’s the whole reason why i made this post
3- I can’t use SurfaceGui’s bcs they don’t support UV’s but Decals, Textures, SurfaceAppearance do but the thing with Decals is that you can multiply the color values which will give you a glow like effect (which is why im using decals)

here’s how the actual mesh looks like if anyone’s wondering

thanks for trying to help tho!

Out of curiosity, does the flicker go away if you set the decal’s color to a normal value?

unfortunately not
IDyyPHSpTk

1 Like

The only other test I can think of at the moment is to try changing the decals faster or slower than they currently are

1 Like

slowing it down made it flicker for a bit then go invisible,
making it faster just made it flicker faster

1 Like