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

How do I correctly nil to tell if something exists?

if v.leaderstats.Rank == nil then
	script.Parent.Main.EditBox.PlayerRole.Text = "Guest"
else
	script.Parent.Main.EditBox.PlayerRole.Text = v.leaderstats.Rank.Value
end

The entire script is not important, all I need is for it to see if the intvalue "Rank" exists. Nil doesn't seem to work. Does anyone know how to correctly tell if something is actually nil or not?

1 answer

✓ Accepted answer

If you wanting to see if an instance exists or not you can do ..

if not v.leaderstats.Rank then
    script.Parent.Main.EditBox.PlayerRole.Text = "Guest"
else
    script.Parent.Main.EditBox.PlayerRole.Text = v.leaderstats.Rank.Value
end

doing it like that would make it the equivalent of a Boolean

1 comment

0

Edit: added the not in, essentially says if v.leaderstats.Rank is not true(exists) then...

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