So i have a shop that players can buy from, Like emotes, cosmetics, you know, basic stuff like that.
Anyways, It works good, But the code is hard to read, and the whole thing is very unorganized, But im not sure how to fix it.
Some emotes are unobtainable, So they are either Admin-only, Or a secret.
What i did to make these not show up in the shop is by adding a boolvalue called “SecretEmote”, But this isnt very organized so i basically had to either guess, or open the emote to see if its secreted.
So then i thought, Hey, Maybe i could just make a seperate folder:
![]()
Cool, Its more organized, But now theres an issue with the code, I dont think its bad, but i think there could be a better way instead of having to check if its in either folder (i have to do this every time i want to check an emote in the code)
if emotes:FindFirstChild(emotename) or unobtainableEmotes:FindFirstChild(emotename) then
--code
end
Or i have to do this:
local emoteinstance = emotes:FindFirstChild(emotename) or unobtainableEmotes:FindFirstChild(emotename)
if emoteinstance ~= nil and rewardinstance.Parent == emotes or emoteinstance.Parent == unobtainableEmotes then
--give emote
end
And i have multiple items to buy, so i have to use a loop through the player’s owned stuff, and see if its in the unobtainable folder or not.
What i could do is using something like GetDescendants(), But theres alot of emotes, and there isnt only emotes and unobtainable emotes, theres remote events, and other folders there too, So it’d loop through those.
this is pretty frustrating, I just want to organize my code to make it nicer.
Any help is appreciated, And sorry if i got something wrong.
