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

I can't seem to figure out why the script won't run?

Asked by 10 years ago
repeat wait() 
until game.Players.NumPlayers >= 2 wait(10)

local Officer = game.ReplicatedStorage.Characters.Officer:GetChildren()

local Cops = {Officer}

local SelcCop = nil

function CopSelect()
    for i, v in pairs(Cops) do
        if game.Players.NumPlayers >= 2 and game.Players.NumPlayers <= 12 then
            SelcCop = game.Players:GetChildren()[math.random(1, game.Players.NumPlayers)]
            for _,l in pairs(SelcCop:GetChildren()) do 
                if l:IsA("CharacterAppearance") then
                l:Destroy() 
            end 
        end
    end
    --if SelcCop ~= nil then
    --end
end
end
CopSelect()

I'm trying to get it to select the 2 players as cops, but it will never run.

0
Also, there is nothing in output when i go to test it. TREVOR818730 25 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Put some prints in there to check to see where it stops. So like:

repeat wait()
until game.Players.NumPlayers >= 2
 wait(10)
print("Cops Selected")
local Officer = game.ReplicatedStorage.Characters.Officer:GetChildren()
local Cops = {Officer}
local SelcCop = nil
function CopSelect()
print("Cops Being Customized")
    for i, v in pairs(Cops) do
        if game.Players.NumPlayers >= 2 and game.Players.NumPlayers <= 12 then
            SelcCop = game.Players:GetChildren()[math.random(1, game.Players.NumPlayers)]
print("OH SNAP TIME TO START")
            for _,l in pairs(SelcCop:GetChildren()) do
                if l:IsA("CharacterAppearance") then
                l:Destroy()
print("Bye bye customizable character. ;3")
            end
        end
   end
    --if SelcCop ~= nil then
    --end
end
end
CopSelect()

0
thanks, i really figured prints were a waste of lines, guess not. TREVOR818730 25 — 10y
0
No problem! deputychicken 226 — 10y
Ad

Answer this question