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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
| |
|
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
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
| |
|
Vexedly
|
  |
| Joined: 15 Sep 2006 |
| Total Posts: 7011 |
|
| |
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
| |
|
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
|
  |
| Joined: 15 Sep 2006 |
| Total Posts: 7011 |
|
| |
|
|
| 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
|
  |
| Joined: 15 Sep 2006 |
| Total Posts: 7011 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 06 Mar 2014 09:55 AM |
| Thanks Free, works perfectly. #StupidMistakes |
|
|
| Report Abuse |
|
|