This is the Code:
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
while true do
for i = 1,10 do
status.Value = "Intermisson "..10-i
wait(1)
end
local rand = math.random(1, #maps)
local map = maps[rand]:Clone()
map.Parent = workspace
status.Value = "We'll be playing "..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.Ingame
end
end
local roundLength = 50
local canWin = true
local roundType = ""
if map:FindFirstChild("Obby") then
roundType = "Obby"
map.EndPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
canWin = false
status.Value = hit.Parent.Name.." has won!"
end
end)
elseif map:FindFirstChild("Sword") then
roundType = "Sword"
local children = workspace.Ingame:GetChildren()
for i = 1,#children do
local tool = map:FindFirstChild("Tool"):Clone()
tool.Parent = children[i]
end
end
map:FindFirstChildWhichIsA("Tool"):Destroy()
end
repeat
roundLength = roundLength -1
status.Value = "Time Left: "..roundLength
wait(1)
until roundLength == 0 or canWin == false or #workspace.Ingame:GetChildren() == 0 or (workspace.Ingame:GetChildren() == 1 and roundType == "Sword")
if workspace.Ingame:GetChildren() == 1 and roundType == "Sword" then
status.Value = workspace.Ingame:FindFirstChildWhichIsA("Model").Name.. " has won!"
end
wait(3)
map:Destroy()
local players = game.Players:GetChildren()
for i = 1,#players do
if players[i].Character ~= nil then
players[i]:LoadCharacter()
end
end
end

31 comments
Now it say attempt to index nil with 'Clone'
Well, that's a separate issue though, which line are you getting that error on?
Line 43
It's most likely because it can't find 'Tool'. Are you sure "Tool" is inside 'map'?
Yes
Are you able to send a screenshot?
wait
Do you have a discord to show pic
Use Gyazo, or upload your screenshot to imgur.com, then just send me the link to the image.
here ya go
https://imgur.com/WHjBCRb
Ah, I see. Did you supposed to do :FindFirstChildWhichIsA("Tool"), because if you look at line 43, you did :FindFirstChild("Tool"), and obviously there is no tool in 'map' that's called "Tool". You've only got "ClassicSword"
so like this map:FindFirstChildWhichIsA("Tool"):Clone().Parent = children[i]
Yea, try it and see if it works.
ok
now it say Expected 'end' (to close 'do' at line 3), got
Okay... Can you paste your code on pastebin or something and send me it?
here ya go https://pastebin.com/JjSXfxDQ
You're missing an end on line 44.
the line 44 is code: end
Yes, there needs to be another end there, to close off the if statement.
Just move that end down and then add another one
ok
it say again attempt to index nil with 'Clone'
The same line?
yes line 43
Okay.. Whilst you're testing, check if the Tool is still there, if it is send a screenshot please.
Here ya go https://imgur.com/a/sf12wts
To be honest, I'm not quite sure why you're getting this error, I'm testing with the exact same code you have on line 43, and it seems to be working for me, all I can say is that the issue is that it can't find the tool in the map. So make sure that the tool is still in the map when it's being cloned. if this issue still persists, I'd suggest just making another question about it.
Thx
No problem.