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 » Scripting Helpers
Home Search
 

Re: This script crashes Studio?

Previous Thread :: Next Thread 
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
19 Sep 2013 11:04 PM
I don't have a laggy computer. It's generaly very fast.

I'm working on getting a script to spawn some basic parts for me every five seconds, and whenever I try playing it in Studio, I just crash.

It's not complete by the way.

while true do
function onBox (boxy)
Instance.new("Part",boxy,script.Parent)
wait(5)
end
end
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
19 Sep 2013 11:05 PM
Too many errors.

while true do
function onBox(boxy)
Instance.new("Part",boxy)
end
boxy();
wait();
end
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
19 Sep 2013 11:12 PM
Thanks, it doesn't crash.

Nor does it work. Apparently, global "boxy" is a nil value. But isn't it the new part being generated?
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
19 Sep 2013 11:26 PM
Do you really need it as a function?

while wait(5) do
Instance.new("Part",Workspace).Position = Workspace.BasePlate.Position
end
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
19 Sep 2013 11:27 PM
@OP, you need to set boxy's argument.
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
20 Sep 2013 08:40 AM
I thought that would be this (Which doesn't work):

boxy = script.Parent

while true do
function onBox(boxy)
Instance.new("Part",boxy)
end
boxy();
wait(5);
end
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
20 Sep 2013 08:41 AM
Unless..Have I not called the function?
Report Abuse
lupine is not online. lupine
Joined: 24 Jun 2008
Total Posts: 3561
20 Sep 2013 09:09 AM
also you don't have to do 'while true do'

while wait() do saves lines and space.
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
20 Sep 2013 05:34 PM
Still doesn't work though. Doesn't "boxy()" call the function?

boxy = script.Parent

while wait(5) do
function onBox(boxy)
Instance.new("Part",boxy)
end
boxy()
end
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
20 Sep 2013 05:39 PM
onBox() calls the function. Not boxy(). And while I'm at it, its never smart to define a function INSIDE a while loop. Nor in this case do you need the argument boxy inside onBox. function onBox() is fine.
Simply because in the function's parenthesis, it gives a new name to whatever is inside the parenthesis. So for instance,

function add(a, b)
print(a+b)
end

k = 2
l = 5
add(k, l)

In the function, a = k = 2, b = l = 5. It should print 7.
Hope this helps. Now the actual script should be.

boxy = script.Parent

function onBox()
Instance.new("Part",boxy)
end

while wait(5) do
onBox()
end
Report Abuse
marcopolo444 is not online. marcopolo444
Joined: 02 May 2010
Total Posts: 5114
20 Sep 2013 05:59 PM
basically the same script you had, but just change

boxy()

to

onBox() --the name of the function you are trying to call
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
20 Sep 2013 06:32 PM
I had to change a lot of stuff, but ended up getting it working. Just need to work on getting randomized properties now.
Report Abuse
08C is not online. 08C
Joined: 26 Jan 2013
Total Posts: 847
20 Sep 2013 06:37 PM
[ Content Deleted ]
Report Abuse
airplanejoe is not online. airplanejoe
Joined: 19 Oct 2011
Total Posts: 5767
20 Sep 2013 06:57 PM
while true do means a continuous loop, which will cause studio to crash
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
20 Sep 2013 06:58 PM
Airplane, I've used plenty of scripts with while true do, they've never caused it to crash before.
Report Abuse
airplanejoe is not online. airplanejoe
Joined: 19 Oct 2011
Total Posts: 5767
20 Sep 2013 07:00 PM
oh, that's only with the print() command then
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Sep 2013 07:12 PM
No.

You CAN do while true do anytime, as long as there is someway for it to "pause."

If you just plain:
while true do end

Then it will crash the game.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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