Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a changing decal on click?

Asked by 7 years ago
Edited 7 years ago

How can I make a changing decal on mouse click?

Where would I put the script? ( in the part, workspace, server script service? )

Local Script or Regular Script?

I tried this to see if I could make it wait 30 seconds but it didn't work.

0101  01  function click()
0202  02  while true do
0303  03  Decal1.Texture.Decal.Texture="rbxassetid://1568188388"--Copy this line and the one below it for more pictures
0404  04  wait(5)
0505  05  script.Parent.Decal.Texture = "rbxassetid://1571532370"--Edit for your textures asset Id.
0606  06  wait(5)
0707  07  script.Parent.Decal.Texture = "rbxassetid://1571532122"
0808  08  end
0909  09  end
1010  10  script.Parent.ClickDetector.MouseClick:connect(click)
0
I fixed that but it's still not working Innovation_dev 2 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Ok so here's what you need to do.

First, create 3 decals instead of one inside the part. (For example)

Name them each D1, D2, D3.

Set each of the image id's in the decals's texture

Set the D2 and D3's transparency to 1.

Right click the part in Explorer > Insert Object > Click Detector.

Then do the same thing for the server script, (aka Script) and insert that too with this code:

TL;DR: Create three Decals, name them each D1, D2, D3. Set the D2 and D3's transparency to 1. Set the image id's into the texture value. Insert click detector, and insert normal script with this code.

01script.Parent.D1.Transparency = 0
02function click()
03while true do
04script.Parent.D1.Transparency = 0
05script.Parent.D3.Transparency = 1
06wait(30)
07script.Parent.D2.Transparency = 0
08script.Parent.D1.Transparency = 1
09wait(30)
10script.Parent.D3.Transparency = 0
11script.Parent.D2.Transparency = 1
12wait(30)
13end
14end
15script.Parent.ClickDetector.MouseClick:connect(click)

Hopefully this code works for you! It should because I tested it. PS: Please tell me if there is any other easier way if possible. EDIT: Made minor mistakes but they should be fixed.

0
I put it in exactly as you said and it's just staying on decal 3 :P Innovation_dev 2 — 7y
0
Turns out i missed a step but when I click the part it doesn't change to the other decal Innovation_dev 2 — 7y
0
Hmm... That's funny because it worked for me... Maybe it's because it's set for 30 seconds instead of one? iiGamer_Master 1 — 7y
Ad

Answer this question