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 » Scripters
Home Search
 

What's PCall

Previous Thread :: Next Thread 
Cyls is not online. 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
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
25 Dec 2015 09:44 PM
Protected Call
Report Abuse
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
25 Dec 2015 10:12 PM
Ok he knows what it is now define it.
Report Abuse
metologyaddict is not online. metologyaddict
Joined: 09 Dec 2015
Total Posts: 378
25 Dec 2015 10:16 PM
[ Content Deleted ]
Report Abuse
DrHaximus is not online. 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 is not online. 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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
25 Dec 2015 10:31 PM
@chimm is right sorry, it returns false if there's an error.
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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