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

How to make value go up when key is held and value stop when key is not held?

Asked by 6 years ago
Edited 6 years ago

Hi, I tried to this script. It is making my roblox studio shut down. I would like to know how I can fix or do it in another completely different way. The lel is an intvalue in the workspace

local uis = game:GetService("UserInputService")
local yes = game.Workspace.lel
local lel = false

uis.InputBegan:connect(function(i,gp)
    if i.KeyCode == Enum.KeyCode.F and not gp then
        lel = true
        if lel == true then
            repeat
                yes.Value = yes.Value + 1
            until lel == false
        end

    end
end)


uis.InputEnded:connect(function(i,gp)
    if i.KeyCode == Enum.KeyCode.F and not gp then
        lel = false

    end
end)

Thanks, activatesenju

0
try adding a wait() after the repeat AttentionHog 70 — 6y

Answer this question