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

why wont it put a count down when you are spawned in the map?

Asked by 4 years ago
Edited 4 years ago

error: 10:26:56.894 - ServerScriptService.Main:41: attempt to perform arithmetic (sub) on nil and number

    local status = game.ReplicatedStorage.Status

local Maps = game.ReplicatedStorage.Maps:GetChildren()

       local Maps = game.ReplicatedStorage.Maps:GetChildren()

while true do for i = 1,10 do status.Value = "Intermission "..10-i wait(1) end

    local Random = math.random(1, #Maps)

local map = Maps[Random]:Clone()
map.Parent = workspace

status.Value = "Todays Challenge Will Be "..map.Name
wait(4)

local players = game.Players:GetChildren()
for i = 1,#players do
    if players[i].Character ~= nil then
                local spawnLocation = math.random(1,#workspace.Teleports:GetChildren())
                        players[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnLocation].Position)
                        players[i].Character.Parent = workspace
            end
            end

local rounddLength = 20
local canWin = true

if map:FindFirstChild("Obby")then
    map.EndPart.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            canWin = false
            status.Value = hit.Parent.Name.."Has Beaten This Deadly Challenge"
        end
    end)
end

repeat
    roundLength = roundLength -1
    status.Value = "Time Remaining"
    wait(1)
until roundLength == 0 or canWin == false or #workspace.ingame:GetChildren() == 0

wait(3)
map:Destrory()

end

0
roundLength is nil and also, It is impossible to perform arithmetic on a nil value. raid6n 2196 — 4y
0
edited my answer raid6n 2196 — 4y

2 answers

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

You spelt roundLength ad Destroy wrong, you silly goose!

Try this:

local status = game.ReplicatedStorage.Status

local Maps = game.ReplicatedStorage.Maps:GetChildren()

local Maps = game.ReplicatedStorage.Maps:GetChildren()

while true do
    for i = 1, 10 do
        status.Value = "Intermission " .. 10 - i
        wait(1)
    end
    local Random = math.random(1, #Maps)

    local map = Maps[Random]:Clone()
    map.Parent = workspace

    status.Value = "Todays Challenge Will Be " .. map.Name
    wait(4)

    local players = game.Players:GetChildren()
    for i = 1, #players do
        if players[i].Character ~= nil then
            local spawnLocation = math.random(1, #workspace.Teleports:GetChildren())
            players[i].Character:MoveTo(workspace.Teleports:GetChildren()[spawnLocation].Position)
            players[i].Character.Parent = workspace
        end
    end

    local roundLength = 20
    local canWin = true

    if map:FindFirstChild("Obby") then
        map.EndPart.Touched:Connect(
            function(hit)
                if hit.Parent:FindFirstChild("Humanoid") then
                    canWin = false
                    status.Value = hit.Parent.Name .. "Has Beaten This Deadly Challenge"
                end
            end
        )
    end

    repeat
        roundLength = roundLength - 1
        status.Value = "Time Remaining"
        wait(1)
    until roundLength == 0 or canWin == false or #workspace.ingame:GetChildren() == 0

    wait(3)
    map:Destroy()
end


0
it better now but it only says time remaining and a error popped up saying Destroy is not a valid model JordanTheDev_Team 33 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

0
???????????????????????? raid6n 2196 — 4y

Answer this question