its printing nil and idk why it is, ive double checked everything and i cant find anything that would go wrong?!

local thing = {"Standard Crate", "Specialized Crate", "Rare Crate", "High-End Crate", "Exotic Crate", "God-Tier Crate"}

local function checkcrate(crate)
	local a = nil
	local check = crate.CrateClaim.CrateGuiNotification.ObjectImage.CrateName.Value
	for i, v in pairs(thing) do
		if check == v then
			a = v
		end
	end
	return(a)
end
for i, v in pairs(game.workspace:GetDescendants()) do
	if v.Name == "Crate" and v:FindFirstChild("Smoke") ~= nil then
		local j = checkcrate(v)
		print(j)
	end
end

6 comments

0

A lot of this script can be simplified but the logic would be the same. Can you test if the value in CrateName has a match.

0

wym by "match"

0

check == v

0

figured it out

0

was using Value and not Text

0

Please update your question's title to have something like "[Solved]" so we know you've got it figured out