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

Why there is not any delay? I used wait(20)

Asked by 5 years ago

This question has been solved by the original poster.

uhhh another problem with the freezedown script. after the power out after 20 seconds it shut kill everyone. It works great but the wait(20) is not working it kills you rihght adter the power out

while true do
temp = game.Workspace.Temp.Value
if temp == -300 then
script.Parent.Parent.Ice:Play()
script.Parent.Parent.Music:Play()
script.Parent.Parent.Alarm2:Play()
wait(120)
script.Parent.Parent.Power:Play()
wait(0.1)
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 0)
wait(20) // here is the problem
for i, player in ipairs(game.Players:GetPlayers()) do
    if player.Character then
        local hum = player.Character:FindFirstChild('Humanoid')
        if hum then
            hum.Health = 0
        end 
end
end
elseif temp == -301 then
script.Parent.Parent.Ice:Play()
script.Parent.Parent.Music:Play()
script.Parent.Parent.Alarm2:Play()
wait(120)
script.Parent.Parent.Power:Play()
wait(0.1)
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 0)
wait(20) // here is it too
for i, player in ipairs(game.Players:GetPlayers()) do
    if player.Character then
        local hum = player.Character:FindFirstChild('Humanoid')
        if hum then
            hum.Health = 0
        end 
end
end
elseif temp == -302 then
script.Parent.Parent.No:Play()
elseif temp == -303 then
script.Parent.Parent.No:Play()
elseif temp == -304 then
script.Parent.Parent.No:Play()
else
script.Parent.Parent.No:Play()
end
wait()
end

2 answers

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

Ok, so first, I just re-formatted your code and removed unnecessary if-then clauses Secondly, I believe the issue is probably one of your Sounds are not being called by their proper names since it runs through these before the player's character.

ServerScript

local folder = script.Parent.Parent

while true do
    local temp = workspace.Temp.Value
    if temp == -300 or temp == -301 then
        folder.Ice:Play()
        folder.Music:Play()
        folder.Alarm2:Play()
        wait(120)
        folder.Power:Play()
        wait(0.1)
        game.Lighting.Brightness = 0
        game.Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 0)
        wait(20)
        for i, player in pairs(game.Players:GetPlayers()) do
            local character = workspace:FindFirstChild(player.Name)
            local hum = character:FindFirstChild("Humanoid")
            if hum then
                hum.Health = 0
            end 
        end
    else
        folder.No:Play()
    end
    wait()
end
0
Please use player.Character User#24403 69 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

Ok i solved it. I enabled team create .My really smart friend was editing the script and put a copy of it in workspace. The script killed everyone in 10 seconds.

Answer this question