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

how do i make the script stop once i click 5 times?

Asked by 6 years ago

i make this basic script

tool = script.Parent
player = game.Players.LocalPlayer:GetMouse()
block = game.Workspace
number = 1


maTable = {block.one,block.two,block.three}


tool.Equipped:connect(function(eventMouse)


    eventMouse.Button1Down:connect(function()
        for i,v in pairs (maTable) do
            number = 1 + 1
            v.Transparency = 1
            wait (1)
            v.Transparency = .5
            if number == 5 then
                break
            end
        end
    end)
end)

how do i make it to stop until i clicked 5 times?

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

It'd be good if there was more of an explanation.

My only guess is that you want to disable the script permanently once it has been clicked five times.

tool = script.Parent
player = game.Players.LocalPlayer:GetMouse()
block = game.Workspace
number = 1


maTable = {block.one,block.two,block.three}


tool.Equipped:connect(function(eventMouse)
    eventMouse.Button1Down:connect(function()
    if number < 5 then
        number = number + 1
            for i,v in pairs (maTable) do
            v.Transparency = 1
            wait (1)
            v.Transparency = .5
            end
    else
        script.Disabled = true
    end
    end)
end)

It'll run the transparency code provided 'number' is less than 5. If number is not less than five, it will disable the script.

Hope this helped.

Thanks,

Explosion

0
oh wow thanks, i didnt know you can script.Disabled thanks :) ReyLaFreeze 26 — 6y
0
wait it doesnt worked i can still clicking and the part still keep transparency ReyLaFreeze 26 — 6y
0
This won't work because you're always setting number to 2. Change the number = 1+1 to number = number +1 Eqicness 255 — 6y
0
Edited script. ZeExplosion 210 — 6y
0
I missed it whilst doing it. ZeExplosion 210 — 6y
Ad

Answer this question