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

My click counting script will not work?

I have a script where when you click on a part it will add to a variable and if the variable is 70, if the part was clicked 70 times, it will change the transparency of a decal on a part, but my if then statement does not want to work. Script:

local CD = workspace.Clock.ClickDetector
local CC = 0

CD.MouseClick:connect(function(click)
	CC = CC + 1
end)

if CC >= 70 then
	workspace.Six.Decal.Transparency = workspace.Six.Decal.Transparency - 1
end

1 answer

✓ Accepted answer
local CD = workspace.Clock.ClickDetector
local CC = 0

CD.MouseClick:connect(function(click)
	CC = CC + 1

	if CC >= 70 then
		workspace.Six.Decal.Transparency = workspace.Six.Decal.Transparency - 1
	end
end)

2 comments

0

Put the if statement inside the MouseClick function so it checks everytime

0

k thanks

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