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

reset of loop w/ if statement not working?

Asked by 4 years ago
script.Parent.ClickDetector.MouseClick:Connect(function(c)
    local cpart = game.Workspace:WaitForChild("notpart")
        local part = cpart:Clone()
    part:Destroy()
    wait(.1)
    cpart.Parent = workspace
end)
    while true do
        if game.Workspace:WaitForChild("boss") then
            script.Parent.ClickDetector.MaxActivationDistance = 0
            script.Parent.Color = Color3.fromRGB(255, 0, 0)
            wait()
        elseif game.Workspace:WaitForChild("boss") == nil then
            script.Parent.ClickDetector.MaxActivationDistance = 32
            script.Parent.Color = Color3.fromRGB(13, 105, 172)
            wait()
        end
    end

there is a part named 'boss' in replicated storage, but when it is deleted, the rgb still remains 255, 0, 0 and the clickdetector does not fix

0
You should use FindFirstChild just incase of infinite loops. speedyfox66 237 — 4y
0
it's a part cloned through a different clickdetector, it's not in the workspace at all times spunkworks 110 — 4y

Answer this question