Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

First half of script doesnt happen unless I remove second half, how do I fix this?

Asked by 2 months ago

Anybody know how to fix this error? The error message is as follows: Workspace.Game:19:bad argument #2 (interval is empty.) Basically, I divided the script into two main parts. When I have the second half in, the game works. When I remove the second half, the first half suddenly works again.

while true do
local plrs = game.Players:GetChildren()
wait(10)

for i= 1,#plrs do
local num = math.random(1,16)
print("test")
plrs[i].Character.Head.CFrame = CFrame.new(workspace.teleport["plate"..num].Position)
plrs[i].TeamColor = BrickColor.new("Lime green")
workspace.Plates["plate"..num].Position = workspace.Plates["plate"..num].Position+Vector3.new(0,20,0)
workspace.Plates["plate"..num]:Clone()
workspace.Plates["plate"..num]:Clone().Parent = workspace.Ingameplates
workspace.Plates["plate"..num].Position = workspace.Plates["plate"..num].Position+Vector3.new(0,-20,0)
end
--FIRST HALF COMPLETED
repeat

local plates = workspace.Ingameplates:GetChildren()
local plate = plates[math.random(1,#plates)] --error at this line
local events = workspace.Events:GetChildren()
local event = events[math.random(1,#events)]
local eventname = event.Name
    for i= 1,#plrs do
    game.ServerStorage.label.TextLabel.Text = eventname    
    game.ServerStorage.label:Clone().Parent = plrs[i].PlayerGui
    end
wait(3)
event:Clone().Parent = plate
wait(2)
    alive = 0
    dead = 0
    for _,v in pairs(game.Players:GetChildren()) do
    if v.TeamColor.Name == "Lime green" and v.Neutral == false then
    alive = alive + 1
    elseif v.TeamColor.Name == "Really red" and v.Neutral == false then
    dead = dead + 1
end 
end
until alive == 0 
for i= 1,#plrs do
game.ServerStorage.label.TextLabel.Text = "Game has ended!"    
game.ServerStorage.label:Clone().Parent = plrs[i].PlayerGui
    end
wait(5) 
end

BTW This is NOT stolen. The people on the discord server won't help me because they think this is a free model script. I can assure you that I wrote this. I plan on making this a template that people can use to make their own plates of fate game, kind of like Roblox's game templates.

Answer this question