I am currently scripting a teleporting script but it's not working and 22:24:14.136 - ServerScriptService.Script:53: 'end' expected (to close 'if' at line 33) near '' shows. Please do not take this down as I need major help and it's a different script from others.
NumPlayers = 3
Minigames = game.ServerStorage.Minigames:GetChildren()
Minigames = {game.ServerStorage.Minigames.Minigame1}
function Msg(text)
print(text)
end
function PlayerAdded(Player)
local Bool = Instance.new("BoolValue",Player)
Bool.Name = "AFK"
local leaderstats = Instance.new("IntValue", Player)
leaderstats.Name = "leaderstats"
local Points = Instance.new("IntValue", leaderstats)
Points.Name = "Points"
end
function GetPlayers()
local Players = {}
for i,v in pairs (game.Players:GetChildren()) do
if v:FindFirstChild("AFK") and not v.AFK.Value then
table.insert(Players, v)
end
end
return Players
end
game.Players.PlayerAdded:connect(PlayerAdded)
while true do
local Players = GetPlayers()
if #Players >= NumPlayers then
Msg("There are enough players to start the game!")
wait(3)
Msg("Choosing A Map...")
local Chosen = Minigames[math.random(1, #Minigames)]
local Clone = Chosen:Clone()
wait(2)
Msg ("Map Chosen!"..Chosen.Name.."Obby.")
Clone.Parent = workspace.CurrentMinigame
Msg("Teleporting players")
for i,v in pairs (Players) do
if v then
local Teleport = Clone.Teleports:GetChildren()[math.random(1, #Clone.Teleports:GetChildren())]
v.Character:SetPrimaryPartCFrame(Teleport. CFrame *CFrame.new(0, 5, 0))
Teleport:Destory()
else
Msg("There aren't enough players to start the game.")
end
wait()
end
Thanks!

6 comments
Missing 2 ends. try indenting your code and the missing ends will reveal themselves.
ok thanks. @ScrewDeath
You should edit this to have the title show that this is answered
Ah , a reminder : change the Teleport:Destory() to Teleport:Destroy()
thanks and fighter ok
@maumau That's perfectly okay. He can just say Teleport.Destroy(Teleport). :Destroy() is just syntax sugar for .Destroy()