Ad
Log in to vote
0

Break not breaking the Touched while loop?

Asked by 15 days ago
Edited 15 days ago

if not Touched then line not breaking the while loop

local debounce = false

game.Players.PlayerAdded:Connect(function(player)
    local stats = Instance.new("IntValue", player)
    stats.Name = "leaderstats"
    local Time = Instance.new("IntValue", stats)
    Time.Name = "Time"
    Time.Value = 0

    local function AddTime(Touched)
        while Touched do
            wait(1)
            if debounce == false then
                Time.Value = Time.Value + 1
                debounce = true
                wait(1)
                debounce = false
            end
            if not Touched then
                break
            end
        end
    end

    workspace.Models.BASEPLATE.Touched:Connect(AddTime)
end)
0
I think you need to use workspace.Models.BASEPLATE.TouchEnded for that. MineBlox_Artz 50 — 15d
0
It would do the same thing... Im just saying that when i touch it, it doesn't wait every second GamerLoIiaz_v2 -6 — 14d

Answer this question