local status = script.StatusBar local values = game.ReplicatedStorage.Values local ticking_clock = 0 local win_amount = 1 local coin_amount = 10 while true do ticking_clock = 10 repeat ticking_clock = ticking_clock - 1 status.Value = "Next Minigame in "..ticking_clock wait(1) until ticking_clock == 0 status.Value = "Minigame Starting!" wait(2) local selectedMap = game.ReplicatedStorage.Maps:GetChildren() local chosenMap = math.random(1, #selectedMap) currentNumber = 0 for i = 1, #selectedMap do currentNumber = currentNumber + 1 if currentNumber == chosenMap then selectedMap[i]:Clone().Parent = game.Workspace.GameSystem currentMap = selectedMap[i].Name status.Value = "The Chosen Game is "..selectedMap[i].Name end end wait(3) local players = game.Players:GetChildren() for i = 1, #players do local randomizedNumber = math.random(1,15) players[i].Character.Head.CFrame = CFrame.new(game.Workspace.Teleports("Part"..randomizedNumber).Position) players[i].Character.Parent = game.Workspace.GameSystem.playersIngame end ticking_clock = 60 repeat ticking_clock = ticking_clock - 1 status.Value = ticking_clock.." Seconds Left!" wait(1) until ticking_clock == 0 or values.WinnerValue.Value ~= "" if values.WinnerValue ~= "" then status.Value = values.WinnerValue.." Has Won!" game.Players[values.WinnerValue.Value].leaderstats.Coins.Value = game.Players[values.WinnerValue.Value].leaderstats.Coins.Value + coin_amount game.Players[values.WinnerValue.Value].leaderstats.Wins.Value = game.Players[values.WinnerValue.Value].leaderstats.Wins.Value + win_amount values.WinnerValue.Value = "" else status.Value = "No-one Has Won This Minigame!" end wait(3) local playersIngame = game.Workspace.GameSystem.playersIngame:GetChildren() for i = 1, #playersIngame do local plr = game.Players:GetPlayerFromCharacter(playersIngame[i]) plr:LoadCharacter() end game.Workspace.GameSystem[currentMap]:Destroy() end
Above is my Script, have errors on line 41 any help please?
Your code looks all fine to me, but you made one tiny mistake— ()’s instead of []’s. On like 41, you need to index the part using []’s, like so:
players[i].Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Teleports["Part"..randomizedNumber].Position) -- also, I recommend teleporting humanoidrootpart instead of head so I changed that for you