Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I access a Variable inside the Pcall function Do I redefine or is there a better way?

local S,E = pcall(function()
	
	local GotAsync = DataStore:GetAsync(plr.UserId)

	return GotAsync
end)


local GotAsync = DataStore:GetAsync(plr.UserId) --ReDefine it?


How would I define it here outside the function do I have to redefine it or is there some other method?

But I think if I redefined it Problems would arise like the GetAsync in Pcall Might be succesful but In GotAsync outisde of the function it might fail

2 comments

0

I believe it is already defined in your code... you could do local plr on line 1

0

Whatever you return in the pcall function will be the E variable

1 answer

local GotAsync
local S,E = pcall(function()
	GotAsync = DataStore:GetAsync(plr.UserId)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.