davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 26 Jul 2015 01:47 PM |
For now, if an error is found - script stops working. But i have 2 same scripts - one works normally as expected and other one errors even though it shouldn't. How can i make so the script ignores the error?
~davisky~ |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Jul 2015 01:48 PM |
You don't want to ignore the error, you want to figure out what is causing it. It's erroring because you're doing something wrong.
But if you don't care about this and you want to have bad habits, use pcall. |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 26 Jul 2015 01:50 PM |
Ok, 2 same scripts:
repeat wait() until script:findFirstChild("Code") if script.Code.Value ~= "" then loadstring(script.Code.Value)() end --Works fine...
repeat wait() until script:findFirstChild("Code") if script.Code.Value ~= "" then loadstring(script.Code.Value)()-- Errors here end
Error: Workspace.Countdown.ScriptBase:3: attempt to call a nil value 21:45:09.488 - Stack Begin 21:45:09.488 - Script 'Workspace.Countdown.ScriptBase', Line 3
Both of them run at the same time.
~davisky~ |
|
|
| Report Abuse |
|
|
Vyxium
|
  |
| Joined: 31 Aug 2010 |
| Total Posts: 1020 |
|
|
| 26 Jul 2015 01:52 PM |
| why do you have parameters after parameters |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Jul 2015 01:53 PM |
| Is the second one in a local script? |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 26 Jul 2015 01:55 PM |
no, both are normal scripts.
(Cntkillme, i just started making a new place, nothing much in there so if you want i can give you a copy of it to investigate)
~davisky~ |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2015 02:33 PM |
Clearly it's because the code in .Value has an error. pcall it if you want the script to continue working.
Also sneaky advertising: There's no way to make a script ignore syntax errors, but there's a suggestion for it here: http://www.roblox.com/Forum/ShowPost.aspx?PostID=154954463
Syntax errors, not logical errors :P |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 27 Jul 2015 03:03 PM |
Tell me, what is the error here then?
while true do wait() if script.Parent.Parent.Value == 0 then script.Parent:Destroy() end
~davisky~ |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 03:04 PM |
repeat wait() until script:FindFirstChild("Code") if script.Code.Value ~= "" then local success, ermsg = pcall(function() loadstring(script.Code.Value)()-- Errors here end) if not success then print(ermsg) end end
Try this instead. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 27 Jul 2015 03:11 PM |
I changed the script a little bit, i managed to remove the error but it doesn't do what it should have. Here is the script:
repeat wait() until script.Parent ~= nil repeat wait() until script.Parent.Value == 0 script.Parent:Destory()
When the value is 0 the thing still stays and keeps decreasing... :/
~davisky~ |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 27 Jul 2015 03:13 PM |
Nvm i just had a typo now. Thanks who tried to help me!
~davisky~ |
|
|
| Report Abuse |
|
|