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
 

Glitch?

Previous Thread :: Next Thread 
Bubu2319 is not online. Bubu2319
Joined: 06 Aug 2011
Total Posts: 1006
20 Dec 2015 01:23 PM
so im 99% sure i wrote this code right. so i think its a glitch (note: i dont know what line does this). it is suppose to spawn you on the map but it removes the map, then spawns you (you fall to your death) then regenrates the map. not sure if its this loop or another one. thoughts?

local spawnsmodel = newmap:WaitForChild("Spawns")
local spawns = spawnsmodel:GetChildren()
for _, player in pairs(players) do
if player and player.Character and #spawns > 0 then
local torso = player.Character:WaitForChild("Torso")
local humanoid = player.Character:WaitForChild("Humanoid")
local playerspawn = math.random(1,#spawns)
local spawn = spawns[playerspawn]
if torso and humanoid and spawn then
humanoid.Health = 100
humanoid.WalkSpeed = 16
table.remove(spawns,playerspawn)
Report Abuse
Bubu2319 is not online. Bubu2319
Joined: 06 Aug 2011
Total Posts: 1006
20 Dec 2015 01:23 PM
editor note: this is a loop so it goes on forever.
Report Abuse
XIPokezIX is not online. XIPokezIX
Joined: 24 Sep 2015
Total Posts: 381
20 Dec 2015 01:36 PM
table.remove(spawns,spawns[playerspawn])
Report Abuse
Bubu2319 is not online. Bubu2319
Joined: 06 Aug 2011
Total Posts: 1006
20 Dec 2015 01:39 PM
error on that line

12:38:41.099 - ServerScriptService.Script:67: bad argument #2 to 'remove' (number expected, got Object)
Report Abuse
XIPokezIX is not online. XIPokezIX
Joined: 24 Sep 2015
Total Posts: 381
20 Dec 2015 01:54 PM
What exactly do you wanna remove. The model of a value from a table.
Report Abuse
Bubu2319 is not online. Bubu2319
Joined: 06 Aug 2011
Total Posts: 1006
20 Dec 2015 01:59 PM
lol stupid me, i had it so it removes the spawns to early. i just had to move one line and end the function at the very instead of half way through. thanks for the help
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
20 Dec 2015 02:00 PM
Well from the looks of things, the playerspawn variable isn't being recognized as a number, which doesn't make much sense.

I could probably analyze this better if I could see the entire script.
Do you know what line its specifically pointing to?
Report Abuse
Bubu2319 is not online. Bubu2319
Joined: 06 Aug 2011
Total Posts: 1006
20 Dec 2015 02:03 PM
@Clone it was a line that wasn't part of this function at all that was removing the map, I moved it down to the next function and removed an end and put it at the very bottom of the script. Now everything is running smooth. Thanks for the help though
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