generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script error help

Previous Thread :: Next Thread 
Coconutko is not online. 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 is not online. 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
ThrownException is not online. ThrownException
Joined: 17 Apr 2009
Total Posts: 1945
30 Jul 2015 11:19 PM
Try making sure that humanoid exists before calling it.

That might be the issue.
Report Abuse
Coconutko is not online. 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 is not online. 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 is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
30 Jul 2015 11:37 PM
Perhaps define line 24?
Report Abuse
Coconutko is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
31 Jul 2015 12:10 AM
You don't need an extra 'end'
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image