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: LocalScript Crashes Roblox

Previous Thread :: Next Thread 
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 01:19 PM
I have no way of figuring out what's wrong with this. This is under a textbutton, when I click it Roblox crashes...

local LocalPlayer=Game.Players.LocalPlayer
local Holder=Instance.new('StringValue')
Holder.Parent=Game.Lighting
Holder.Name=LocalPlayer.Name.."'s tools"
local FightMode=true
local tools={Game.Lighting.Tool1, Game.Lighting.Tool2, Game.Lighting.Tool3, Game.Lighting.Tool4, Game.Lighting.Tool5}
local num
function SwitchMode()
if FightMode==true then
local things=LocalPlayer.Backpack:GetChildren()
repeat
if things[num] then
things[num].Parent=Holder
end
until num==#things+1
num=1
repeat
local clone=tools[num]:Clone()
clone.Parent=LocalPlayer.Backpack
num=num+1
until num==#tools+1
local ff=Instance.new('ForceField')
ff.Parent=LocalPlayer.Character
script.Parent.Text="Fight"
num=1
FightMode=false
elseif FightMode==false then
local one=LocalPlayer:FindFirstChild("Tool1", true)
local two=LocalPlayer:FindFirstChild("Tool2", true)
local three=LocalPlayer:FindFirstChild("Tool3", true)
local four=LocalPlayer:FindFirstChild("Tool4", true)
local five=LocalPlayer:FindFirstChild("Tool5", true)
local six=LocalPlayer.Character:FindFirstChild("ForceField", true)
one:Destroy()
two:Destroy()
three:Destroy()
four:Destroy()
five:Destroy()
six:Destroy()
script.Parent.Text="Build"
num=1
FightMode=false
end
end
script.Parent.MouseButton1Click:connect(SwitchMode)
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
05 Mar 2014 01:21 PM
Add prints and waits in there to determine which section of the code isn't working out for you, that's a lot of code to go through as it is.
Report Abuse
crazynerd11 is not online. crazynerd11
Joined: 07 Oct 2011
Total Posts: 335
05 Mar 2014 01:22 PM
"'s tools" Extra quote? Also shouldn`t it since it has a space be ["s tools"]?
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
05 Mar 2014 01:26 PM
""'s tools" Extra quote? Also shouldn`t it since it has a space be ["s tools"]?"

No that is just adding letters onto a string, and is formatted correctly.
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 01:27 PM
Ok, I'll go try that...
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 01:35 PM
It was something in here:

repeat
if things[num] then
things[num].Parent=Holder
end
until num==#things+1
num=1
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 02:01 PM
bump?
Report Abuse
Vexedly is not online. Vexedly
Joined: 15 Sep 2006
Total Posts: 7011
05 Mar 2014 02:03 PM
[ Content Deleted ]
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 02:16 PM
ok, thanks
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 02:21 PM
I added a wait() at the beginning of the repeat, and it didn't freeze. But all it did was make the stringvalue, nothing else happened, nothing on the output either
Report Abuse
Vexedly is not online. Vexedly
Joined: 15 Sep 2006
Total Posts: 7011
05 Mar 2014 03:49 PM
[ Content Deleted ]
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Mar 2014 03:53 PM
repeat
if things[num] then
things[num].Parent=Holder
end
until num==#things+1

Nothing ever changes num and it is waiting for num to be a certain value causing a crash.
Report Abuse
Vexedly is not online. Vexedly
Joined: 15 Sep 2006
Total Posts: 7011
05 Mar 2014 04:09 PM
[ Content Deleted ]
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Mar 2014 04:11 PM
That wasen't the reason for the crash the reason was the loop never ended. Although having it wait is a solution it is not what he wants.
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
05 Mar 2014 06:24 PM
ah thanks free, ill fix that later, I don't have good enough internet to download the place again to edit it at the moment
Report Abuse
trogyssy is not online. trogyssy
Joined: 29 Oct 2010
Total Posts: 2322
06 Mar 2014 09:55 AM
Thanks Free, works perfectly. #StupidMistakes
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