minigames = game.Lighting.Minigames:GetChildren() h = Instance.new("Message", workspace) m = Instance.new("Hint", workspace) while true do if game.Players.NumPlayers > 1 then h.Text = "Choosing game to play" wait(3) ranGame = math.random(1, #minigames) gameChosen = minigames[ranGame] h.Text = gameChosen.Name .. ": Game Chosen" wait(3) gameChosenClone = gameChosen:Clone() gameChosenClone.Parent = game.Workspace --Countdown for i = 10, 1, -1 do m.Text = "Time left: ".. m end m.Text = "Game over" wait(3) gameChosenClone:Destroy() else h.Text = "One more player need for the game to begin" end wait(1) end
The error reads "19:40:54.767 - Replication: Can't create default object of type Workspace
19:41:01.742 - Workspace.MainScript:18: attempt to concatenate global 'm' (a userdata value)"
Thank you!
You must've had a little brain fart at line 18. Replace the "m" at the end with "i", concatenating the iteration number to the text.
m.Text = "Time left: ".. i
Also, try moving your minigames to ReplicatedStorage/ServerStorage to get rid of that first error.
At line 19, you're ending the conditional, and putting "else" later on. Get rid of that "end" on line 19, and instead put the 3 lines starting with "else" in there.
minigames = game.Lighting.Minigames:GetChildren() h = Instance.new("Message", workspace) m = Instance.new("Hint", workspace) while true do if game.Players.NumPlayers > 1 then h.Text = "Choosing game to play" wait(3) ranGame = math.random(1, #minigames) gameChosen = minigames[ranGame] h.Text = gameChosen.Name .. ": Game Chosen" wait(3) gameChosenClone = gameChosen:Clone() gameChosenClone.Parent = game.Workspace --Countdown for i = 10, 1, -1 do m.Text = "Time left: ".. i --First error fixed else --Second error fixed h.Text = "One more player need for the game to begin" end m.Text = "Game over" wait(3) gameChosenClone:Destroy() wait(1) end