Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Yep, this worked. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.