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
2 years ago
Edited 2 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 2 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 — 2y
Ad

Answer this question