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

How would I make it so that when a click detector is clicked again, it changes the decal?

Asked by
dxrrevn 13
3 years ago
Edited 3 years ago
01local powerbutton = script.Parent.Parent
02local screen = workspace.screen
03 
04if script.Parent.MouseClick:Connect(function()
05        screen.Decal.Texture="rbxassetid://4495566781"
06 
07if script.Parent.MouseClick:Connect(function()
08        screen.Decal.Texture="rbxassetid://1396604525"
09    end)
10end

I have this. Where it says if script.Parent.MouseClick:Connect(function() screen.Decal.Texture="rbxassetid://1396604525" I want that to be what happens once the ClickDetector (script.Parent) is clicked again.

1 answer

Log in to vote
0
Answered by 3 years ago

Im not sure if you want the decals to change only once or for it to repeat.

01local decalnumber = 1
02script.Parent.MouseClick:Connect(function()
03    if decalnumber == 1 then
04        decalnumber = 2
05            screen.Decal.Texture="rbxassetid://1396604525"
06    elseif decalnumber == 2 then
07        decalnumber = 1
08        screen.Decal.Texture="rbxassetid://1396604525"
09    end
10end)

This should repeat the decals back and forth every time it is clicked.

0
Yep, this worked. Thanks! dxrrevn 13 — 3y
Ad

Answer this question