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

How do i make a script where you can only click a part with a clickdetector twice? (more in bio)

Asked by 4 years ago

I need a script where you only can press the part that has a ClickDetector in it a certain amount of times, for each player. This is the script so far, any help appreciated. Thank you in advance.

``script.Parent.MouseClick:Connect(function()
        if Character:WaitForChild("Humanoid").WalkSpeed + 76
    end
end)``
0
This script is uncompleted, you are missing "then" and if line is double tabbed. karlo_tr10 1233 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Well my guess is that you wanted the player to be able to click it only twice. heres a little script that you can build off of.

local TimesLeftToClick = 2

script.Parent.MouseClick:Connect(function(Player)
    if TimesLeftToClick >= 1 then
        TimesLeftToClick = TimesLeftToClick - 1
        Player.Character:WaitForChild("Humanoid").WalkSpeed = Player.Character:WaitForChild("Humanoid").WalkSpeed + 76
    end
end)
0
Thank you, it worked. TheJacksterYT 19 — 4y
Ad

Answer this question