Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Studio crashes when a round loads?

Asked by 10 years ago

I know the title may be vague, but there wasn't really any better way to explain it. Basically, I'm making a game that works in a round system (ROBLOX version of Trouble in Terrorist Town, if that helps). That is, pre-game, in-game, post-game, repeat.

But I noticed an issue. I made a server with four players in Studio and it crashes when the round ends, after a certain message.

Here's the snippet of code the error should be around:

01local mapDir = game.ServerStorage.Maps
02 
03    local newMap = mapDir:GetChildren()[math.random(#mapDir:GetChildren())]
04 
05    local m = Instance.new("Message",game.Workspace)
06    m.Text = "New game starting with the "..newMap.Name.." map..."
07 
08    wait(5)
09    m:Destroy()
10 
11    newMap:clone().Parent = game.Workspace.Map
12 
13    local newTraitors = choose_traitors(2)
14 
15    for a,b in pairs(playerDir:GetChildren()) do
View all 35 lines...

The script crashes the pseudo-server after the m.Text = "New game starting with the "..newMap.Name.." map..." message displays for 5 seconds.

(if you need the choose_traitors() function, ask)

0
Maybe it's the amount of parts you have in your maps (regarding line 11). I would like to see the 'choose_traitors()' function, but it might not be the problem. Redbullusa 1580 — 10y
1
Instead of cloning a whole map to Workspace, break up the map into different groupings and then check to see if the CFrame of each grouping is correct. FearMeIAmLag 1161 — 10y

Answer this question