Cyls
|
  |
| Joined: 31 Aug 2008 |
| Total Posts: 166 |
|
|
| 25 Dec 2015 09:42 PM |
Don't know what the full statement or what ever it is does.
Though, if it's not what I'm looking for. I got another question,
while true do Speed = script.Parent.Parent.Speed
script.Parent.a.BrickColor = BrickColor.new("Medium stone grey") wait(Speed) script.Parent.a.BrickColor = BrickColor.new("Black") end
The speed is a number value, there's a button that change its value. But, after pressing the button, it decreases the speed by -.1
But its not updating it, any way how? |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Dec 2015 10:12 PM |
| Ok he knows what it is now define it. |
|
|
| Report Abuse |
|
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 25 Dec 2015 10:17 PM |
| protected call is used for potentially volatile code, code that may cause errors. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 25 Dec 2015 10:30 PM |
| Pcall catches errors. If it does catch an error it returns false and the error message, otherwise it returns true and whatever the function returns. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 10:31 PM |
| It lets you check if code will error or not, and if it does error it will return true. This allows you to handle critical errors in scripts instead of doing a regen or some insane workaround system. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 10:31 PM |
| @chimm is right sorry, it returns false if there's an error. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 10:35 PM |
local wrongfunc = function() p("hi") -->>undefined end
local rightfunc = function() print("hi") -->>defined end
local success, error = pcall(wrongfunc) >false, "Attempt to index global 'p' (a nil value)" local success, error = pcall(rightfunc) >true, nil
I believe that's accurate. |
|
|
| Report Abuse |
|
|