I want to protect my calls in case something goes wrong the whole game wouldn't be broken, but how do I get the results from the functions? For example:
function randomstuff()
a = pcall(math.random,1,100)
if a then
print([The result])
else return false
end
end
How would I get the results from the pcall?
A more pratical use would be:
function safeaddvalue(parent,name,value,add)
a = pcall(value.Value = value.Value + add)
if not a then
b = Instance.new("NumberValue",parent)
b.name = name
b.value = add
return false
else return true
end
end
My temporary solution:
function randomstuff()
a = pcall(b = math.random,1,100)
if a then
print(b)
else return false
end
end
Is it the correct way to do it? if not, what is?

1 comment
You're assigning the result to the variable 'a' in your first example.