|
| 06 Feb 2014 08:24 PM |
I tried scripting myself a Custom Map Loader. But, it runs before it's supposed to! Please help, No idea what went wrong and how to fix! Also, when it says "Selecting map" or a little after, it makes me leave studio. (lag attack)
on = false function GameTime() if game.Players.NumPlayers >= 1 then on = true m = Instance.new("Hint",game.Workspace) m.Text = "Waiting for next game." wait(15) m.Text = "Selecting a map..." wait(15) map = math.random(1,4) --Map settings if map == 1 then MapClone = game.Lighting["map"]:Clone() MapClone.Parent = game.Workspace elseif map == 2 then MapClone2 = game.Lighting["map"]:Clone() MapClone2.Parent = game.Workspace elseif map == 3 then MapClone3 = game.Lighting["map"]:Clone() MapClone3.Parent = game.Workspace elseif map == 4 then MapClone4 = game.Lighting["map"]:Clone() MapClone4.Parent = game.Workspace wait(1.5) m.Text = "A map has been selected!" wait(2) m.Text = "BEGIN!" Players = game.Players:GetChildren() for i,v in pairs(game.Players:GetChildren()) do game.ServerStorage.Armor:Clone().Parent = v.PlayerGui game.ServerStorage.Classes:Clone().Parent = v.PlayerGui game.ServerStorage.Locations:Clone().Parent = v.PlayerGui wait(1) m.Text = "Eliminate your opponents!" wait(160) m.Text = "Round over!" wait(2) Players2 = game.Players:GetChildren() for i = 1,#Players2 do Players2[i]:LoadCharacter() --Respawns them wait(3) m.Text = "Checking for required players.." wait(3) on = false end end end end end
while true do if on == false then GameTime() wait(3) end end |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:25 PM |
MapClone = game.Lighting[map]:Clone()
No quotes for map |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2014 08:26 PM |
| Actually, yes. There are quotes for that. It wouldn't make a difference anyhow. I said it happens before the function calls for it.. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:28 PM |
| Why are you using lighting to store the maps? Use server storage. Also instead of doing "while true do" just make on a boolvalue in workspace and when the value is changed it will check if it was changed to true and then call the function. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:29 PM |
| Come on guys! I worked hard on making this. I tried making it local. But again, it works it's magic before the function calls for it! Please help!! |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:30 PM |
| Xtreme, it seems fine the way it is. Does any of this have to do with the issue? |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:30 PM |
lol im trippin
#homeworkamusesme |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:31 PM |
| Oh crab apples! I had another map script making the maps! darn it! |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:31 PM |
Try adding an end after these chunks of code:
if map == 1 then MapClone = game.Lighting["map"]:Clone() MapClone.Parent = game.Workspace elseif map == 2 then MapClone2 = game.Lighting["map"]:Clone() MapClone2.Parent = game.Workspace elseif map == 3 then MapClone3 = game.Lighting["map"]:Clone() MapClone3.Parent = game.Workspace elseif map == 4 then MapClone4 = game.Lighting["map"]:Clone() MapClone4.Parent = game.Workspace end --I put this here
--because if you don't add the end after the cloning of map 4, it's going to run the code ONLY if the map # is equal to 4.
for i,v in pairs(game.Players:GetChildren()) do game.ServerStorage.Armor:Clone().Parent = v.PlayerGui game.ServerStorage.Classes:Clone().Parent = v.PlayerGui game.ServerStorage.Locations:Clone().Parent = v.PlayerGui end -- I put this here
--After that, it will run the round for every single player in the game, (not fun.)
for i = 1,#Players2 do Players2[i]:LoadCharacter() --Respawns them end --I put this here |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:32 PM |
| Lol, 8 people already replied after my analysis... |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:33 PM |
| Okay, there is a different, unknown problem. In studio, my code works. But, when it says "Selecting map" it crashes (studio test) meaning, I have to get out of the game. Every froze. Strangest day ever! |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:36 PM |
You confuzzled me, studio crashes or the script crashes?
anyway, let me repeat myself.
if you don't add the end after the cloning of map 4, it's going to run the code ONLY if the map # is equal to 4. |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:36 PM |
| IT WAS JUST A STUDIO THING :D!! |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2014 08:37 PM |
| Teh, Sorry if I was ignoring you. I was a bit in a panic and was rushing. Thanks for your help, and k. |
|
|
| Report Abuse |
|
|
| |
|