PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Animate Images over a Part

Animate Images over a Part

Jun 23 2018, 10:28 AM PST

Problem

Say we have a serious of parts inside of a model. We want to animate an image over the parts to create a scrolling marquee.

Solution

Use a Decal and use an infinite loop iterating over parts within a model.

local decal = Instance.new('Decal')
decal.Texture = 'http://roblox.com/?id=12345'
decal.Face = Enum.NormalId.Front
 
while true do
	for _,v in ipairs(Workspace.Model:GetChildren()) do
		decal.Parent = v
		wait(.25)
	end
end

Discussion

We first create a Decal which and set its Texture. The Texture property sets the image in which is shown on the Decal. A Decal is just an object that controls an image placed on a rendered part. We also set the Face of the decal to an enumeration. The NormalId enumeration controls sides of a part. We want the decal to be positioned on the front of the decal so we use the Enum.NormalId.Front option.

We then create an infinite loop using a while loop. This will make it so that the marquee will loop over and over again. We then iterate through all of the children of a model in the Workspace. We then simply parent the decal to that child of the model (presumably a part) and wait ΒΌ of a second. Then it will continue on to the next part in the model. Once it has completed it will loop again (due to the infinite loop defined in the beginning).

Tags:
  • decal