Programming Decals

I have a bunch of decals that I want to program so they alternate appearing and disappearing. I have no experience with programming decals so I don’t know where I would put the script. I couldn’t find any tutorials, if you happen to know any about this topic please link me to them.
Thanks for reading😀

1 Like

Hi, I answered somebody with a similar question with some pseudocode (example code)

Maybe this will help you?

:slight_smile:

2 Likes

So like it shows an image, then waits lets say, a second then shows another image? Is this what your trying to achieve?

1 Like

Yes charrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

So something like this:

while true do

script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id="

end

Just put the id of the image after the equal sign. If you need to add more, just copy and paste the:

script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id="

If you need any help just ask! :smile:

2 Likes

Let’s say you store the two decals in a folder named “Decals” in ReplicatedStorage. And one of the decals is named “Decal1” and one is named “Decal2”. I’m also assuming your part is named “Part” and is in Workspace. You probably didn’t arrange your game like this, so change the variables so they work.

local  first = game.ReplicatedStorage.Decals.Decal1
local second = game.ReplicatedStorage.Decals.Decal2
local part = game.Workpsace.Part


while true do

local newFirstDecal = first:Clone()
newFirstDecal.Parent = part

wait(2)
newFirstDecal:Destroy()

local newSecondDecal = second:Clone()
newSecondDecal.Parent = part

wait(2)
newSecondDecal:Destroy()
end

Hopefully this works :slightly_smiling_face:

1 Like

Would I put this script in workspace in the part?

You can put it in the workspace I guess.

Well think about it, usually when you have to put in a specific place is when your trying to get a reference from the scripts instance. For example, let’s say this is contained somewhere in the script.

local mypart = script.Parent

If you put the script in workspace, then mypart would be workspace, so in that case of does change the script depending on where you put it. sorry if I over explained this.

1 Like

It won’t let me add a decal to a folder in replicated storage.

You can just add a decal somewhere else and put it in replicated storage.

Also, you don’t have to put the decals in replicated storage. You can put the m in workspace, and do this:

local  first = game.Workspace.Decals.Decal1
local second = game.Workspace.Decals.Decal2

Instead of:

local  first = game.ReplicatedStorage.Decals.Decal1
local second = game.ReplicatedStorage.Decals.Decal2
1 Like