if PLR:FindFirstChild("CanFightBoss").Value == true then --errors when value doesn't exist
else
end
Sure I can replace it with
if PLR:FindFirstChild("CanFightBoss") then
if PLR["CanFightBoss"].Value == true then
end
else
end
But can I shorten it somehow? Or wrap it in something so that the error is dealt with rather than spamming if statements to check if everything leading up to it is okay?
If you want it to wait for it to exist, use :WaitForChild as @JackIsOP2006 , but if at some point, the value is not in the player and you don’t want to wait for it, you coudl do this
local boss = PLR:FindFirstChild("CanFightBoss")
if boss and boss.Value then
elseif not boss
end
Check if the value exists and if it does and its value is true, continue, otherwise check if boss doesn’t eixst