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

My click counting script will not work?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
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)
0
Put the if statement inside the MouseClick function so it checks everytime awesomeipod 607 — 6y
0
k thanks lolkid007 43 — 6y
Ad

Answer this question