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

Why doesn't this work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I know this is a lot of code.. but nothing is happening and there is no output.

local intermissiontime = 20

local serverstorage = game:GetService("ServerStorage")
local replicatedstorage = game:GetService("ReplicatedStorage")
local debris = game:GetService("Debris")
local event = replicatedstorage:WaitForChild("RemoteEvent")
local maps = serverstorage:WaitForChild("Maps")
local mapholder = game.Workspace:WaitForChild("MapHolder")

while true do

--load random map
-[[mapholder:ClearAllChildren()
wait(2)
local allmaps = maps:GetChildren()
local newmap = allmaps[math.random(1, #allmaps)]
newmap.Parent = game.Workspace
wait()]]

--wait for contestants
while true do
wait(2)
contestants = {}
for _, player in pairs(game.Players:GetPlayers()) do
 if  player and player.Character then
  local humanoid = player.Character:WaitForChild("Humanoid")
  if humanoid and humanoid.Health > 0 then
  table.insert(contestants, player)

end
end
end
if #contestants >= 2 then
break else
--what happens if there aren't 3 players
end
end

--choose hp
hp = contestants [math.random(1, #contestants)]

--teleport players to map
--put a brick called Spawn in workspace,put many of them in the map (23:04)
--make a model called Spawns and put them in every map
--make sure you update the map in serverstorage
local spawns = newmap:WaitForChild("Spawns"):GetChildren()
for _, player in pairs(contestants) do
   if player and player.Character and #spawns > 0 then
local torso = player.Character:WaitForChild("Torso")
local spawnindex = math.random(1, #spawns)
local spawn = spawns(spawnindex)
if spawn and torso then
table.remove(spawns, spawnindex)
torso.CFrame = CFrame.new(spawn.Positon + Vector3.new(0, 3, 0))
local backpack = players:FindFirstChild("Backpack")
if backpack then
  if player == hp then
--put potato in serverstorage
local potato = serverstorage:WaitForChild("Potato"):clone()
potato.Parent = backpack

end
end
end
end
end

--after teleporting, remove spawns (optional) 35:14


--round end conditions
   --only one player
--sort game result
    --display results
        --hp winner
--teleport players back to lobby
   --remove tools
--intermission
wait()
end
1
http://gyazo.com/29992c38ef2d8f086e9495b25ab141f1 copy/paste you code where it says '--code' Senor_Chung 210 — 9y

Answer this question