Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:03 PM |
I have a output error and when I try to test my game the server breaks. Here is the error (i have no idea what it means):Workspace.MainScript:24: attempt to index field '?' (a nil value. Here is the script pls pls help i need to finish this quick: minigames = game.Lighting.Minigames:GetChildren()
h = Instance.new("Hint", game.Workspace)
while true do if game.Players.NumPlayers > 1 then h.Text = "Deciding what game to play" wait(3) ranGame = math.random(1, #minigames) gameChosen = minigames[ranGame] h.Text = "Minigame chosen: " .. gameChosen.Name wait(3) gameChosenClone = gameChosen:Clone() gameChosenClone.Parent = game.Workspace wait(3) --Teleporting people to map spawns = gameChosenClone.Spawns:GetChildren() for i,v in pairs(game.Players:GetPlayers()) do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid then v.Character:MoveTo(spawns[i].Position) end end end for i = 3, 1, -1 do h.Text = "Game starts in: " .. i wait(1) end if gameChosenClone == Jungle then local killbot = game.ReplicatedStorage.Velociroblox:clone()--Replace Zombie with the name of your model
function countKillbots() -- gets the number of killbots in the map local count = 7 local list = game.Workspace:children() for i=1,#list do if (list[i].Name == "Velociroblox") then count = count + 1 end--Same here, leave the "s end return count end
function createKillbot()
local x = math.random(51.1,-347.9) local y = 2.5 local z = math.random(-679.2,280.2)--Defines where the models will spawn
local newbot = killbot:clone()
newbot.Parent = game.Workspace newbot.Zombie.Torso.CFrame = CFrame.new(x,y,z) -- little hack a little necessary newbot:move(Vector3.new(x,y,z))
end
-- try to keep 3 - 10 killbots in the map - more might lag? while true do
local count = countKillbots() if (count < 20) then createKillbot() end--How many do you want? wait(.5)
end end --Countdown till the round ends for i = 10, 1, -1 do h.Text = "Time left: " .. i wait(1) end h.Text = "Game ended!" wait(3) gameChosenClone:Destroy() else h.Text = "Needs more than one player to start" end wait(1)
end
|
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:16 PM |
Wow people i really need a reply tonight. PLEASE HELP ME
;-; |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2015 11:19 PM |
Try making sure that humanoid exists before calling it.
That might be the issue. |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:21 PM |
I did didn't you look at the script?
;-; |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:33 PM |
CAN SOMEBODY HELP PLEASE I HAVE TO FINISH THIS BY TOMOROW
;-; ;-; ;-; |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:39 PM |
v.Character:MoveTo(spawns[i].Position)
THX U |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 30 Jul 2015 11:41 PM |
for i,v in pairs(game.Players:GetPlayers()) do
'i' is defined here, under the players.
Change it to '_' or something |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:46 PM |
change the line you showed me or line 24?
|
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 30 Jul 2015 11:49 PM |
| change the for i,v to 'for _,v' |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:54 PM |
what?!?!? it still has the same error on output!!!
If someone helps me I will buy their shirt/pants |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 30 Jul 2015 11:54 PM |
| "spawns[i]" Where exactly are you accessing the "spawns"? |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 30 Jul 2015 11:56 PM |
If the "spawns" are actual spawn locations, and you don't have neutral spawns, and you changed the teams before they teleport, then all you need to do is:
for _,v in pairs(game.Players:GetChildren())do v:LoadCharacter() end |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 30 Jul 2015 11:56 PM |
Well spawns is a variable for some spawns in a map. Maybe i spelt it wrong... |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 31 Jul 2015 12:00 AM |
| They are actual spawns and they're neutral |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 31 Jul 2015 12:03 AM |
| Make them non-neutral. Have like a spectators team for in between the games. Then have a "Playing" team, and makes sure neither team is neutral, (spectators should be autoassigned) and just change the players team when the game starts, then player:LoadCharacter() |
|
|
| Report Abuse |
|
|
Coconutko
|
  |
| Joined: 05 Nov 2014 |
| Total Posts: 6799 |
|
|
| 31 Jul 2015 12:09 AM |
ok should i put a end after the v:LoadCharacter()?
|
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 31 Jul 2015 12:10 AM |
| You don't need an extra 'end' |
|
|
| Report Abuse |
|
|