Hi I have been making a game script and I while i was scripting it keeps saying error expected near elseif. Can you please help with my eof scripting error?? (The error is near the elseif I think it might need another end?) I also need help understanding about the eof. So can you help?
local h = Instance.new("Hint", workspace)
local Players_Found_In_Game = {}
if game.Players.NumPlayers > 1 then
while true do
for g = 10, 0, -1 do
h.Text = "There is " ..g.. " seconds left in the game"
wait(1)
h.Text = "Game ended!"
end
target = CFrame.new(-860.795, 804.22, 192.3)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
print("Players teleported!")
humanoid = v.Character:FindFirstChild("Humanoid")
humanoid.WalkSpeed = 16
for i,Child1 in ipairs(v.Backpack:GetChildren()) do
if Child1.ClassName == "Tool" then
Child1:Destroy()
end
end
for i,Child2 in ipairs(v.Character:GetChildren()) do
if Child2.ClassName == "Tool" then
Child2:Destroy()
end
end
end
wait(1)
for t = 10, 1, -1 do
h.Text = "Intermission " .." ("..t..")"
wait(1)
end
target = CFrame.new(-304.693, 1.5, 432.819)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
print("Game started")
humanoid.WalkSpeed = 0
h.Text = "Game starting in 3"
wait(1)
h.Text = "Game starting in 2"
wait(1)
h.Text = "Game starting in 1"
wait(1)
h.Text = "Go!"
wait(0.5)
for i,Child in ipairs(game.ServerStorage:GetChildren()) do
Child:Clone().Parent = v.Backpack
humanoid.WalkSpeed = 500
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
end)
end)
end)
end
end
elseif game.Players.NumPlayers < 1 then
end
h.Text = "There needs to be more then one player. Invite your friends!"
end
end
end
end

1 comment
Since it's a long script I sortve skimed over it but anyway. You have your h.Text our if the function so the unction already ended then u said what u said. Let me know if this helped. I'm on mobile if it's confusing.