I want to make sure the pcall thing goes through. Is this a good way to make sure that it always goes through or is there a better way to do this? (Without a loop?)

game.Players.PlayerAdded:Connect(function(p)
	local label = p:WaitForChild("PlayerGui"):WaitForChild("currency"):WaitForChild("Frame"):WaitForChild("TextLabel")
	repeat
		wait(1)
		local s,e = pcall(function()
			local store = gold:GetAsync("player_"..p.userId)
			if store then
				label.Text = store
			else
				gold:SetAsync("player_"..p.userId,0)
				label.Text = 0
			end
		end)
	until s == true
end)

1 comment

0

btw label = p:WaitForChild("PlayerGui"):WaitForChild("currency"):WaitForChild("Frame"):WaitForChild("TextLabel")