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
local powerbutton = script.Parent.Parent
local screen = workspace.screen

if script.Parent.MouseClick:Connect(function()
        screen.Decal.Texture="rbxassetid://4495566781"

if script.Parent.MouseClick:Connect(function()
        screen.Decal.Texture="rbxassetid://1396604525"
    end)
end

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.

local decalnumber = 1
script.Parent.MouseClick:Connect(function()
    if decalnumber == 1 then
        decalnumber = 2
            screen.Decal.Texture="rbxassetid://1396604525"
    elseif decalnumber == 2 then
        decalnumber = 1
        screen.Decal.Texture="rbxassetid://1396604525"
    end
end)

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