Need Help With Skin System

I’m working on a game called “Slime Simulator” where the characters are one part with a blob mesh with a face. In order to implement skins, I am trying to use a hat system where your head and HumanoidRootPart are invisible, where the accessory is the visible slime.

However, it wasn’t long before I stumbled across a problem.
For context, please refer to this video: https://www.youtube.com/watch?v=t6FaB0dWBTg&t=817s
The only “error” I get is infinite yield warnings, but there aren’t any actual errors. My results have concluded in the inventory button and the “Buy” buttons on the crates not working. It seems to be able to read the prices of the crates perfectly fine.
Note: I have made small changes like changing “Money” to “Points”.

I looked around the comments and description of the video and found a somewhat relative Devforum post (the featured topic on my profile atm), and couldn’t find anyone else with my problems.

I was wondering if somebody could look through the scripts and help me out? I’m not the best programmer but I have a passion for development. If need be, I could provide a .rbx file of my modified system privately through Discord for security purposes. If this would be beneficial, please contact me at Aiden#5913.

1 Like

Infinite Yield warnings happen when you call WaitForChild() on an Instance to wait for a child that never existed for the specified yield time (if not specified its 5 seconds by default), meaing:
Check for any spelling issues, capatalization, or just check what Instance you’re trying to call WaitForChild() on. (yes, WaitForChild() is case sensitive)

2 Likes

That might be your issue, the Infinite Yield warnings.

I don’t think it would be, I checked over it and everything from what I could tell is proper. ‘Hats’ and ‘Points’ are capitalized properly.

1 Like

That doesn’t look good (happens whenever trying to buy something.).

Huh. That never showed up for me?

Can you send me whats on line 92?

Of which script?

–This text is to meet the 30 character requirements. Ignore it.–

1 Like

game.StarterGui.HatShopGui.HatShopGuiScript

1 Like
hatImageClone:WaitForChild("Title").TextColor3 = rarityColorOrder[hats[2]]
1 Like

Send me the entire table of rarityColorOrder.

local rarityColorOrder = {
	Common = Color3.fromRGB(94,93,89),
	Uncommon = Color3.fromRGB(15,243,49),
	Rare = Color3.new(0,0,132),
	Epic = Color3.fromRGB(131,14,131),
	Legendary = Color3.fromRGB(255,85,0),
	Mythical = Color3.fromRGB(189,0,0),
}
1 Like

Table of hats?

[30charsssss]

I can’t find any table named hats in the script, but in ServerStorage I have a folder named Hats that contains the following:

Blue Slime
Flaming Slime
Green Slime
Pink Slime
Red Slime
Sparkly Slime

1 Like

Then hats[2] is returning nil, and since there’s no value named or indexed under nil, it’ll return nil.
Thats your problem.

You might want to rewrite the code or store a rarity table value 1 - 6 for the colors.

So what you’re saying is I need to create a table of objects (being the hats) in a for loop?

Nono, create a table for a hat. Example:

{
	hat = [hat object or name]
	rarity = [value 1 - 6 for rarity color]
}

Then in line 92 just use rarityColorOrder[[hat table variable].rarity].

1 Like

Well, not that this is a problem, but wouldn’t that require a table for every hat?
Sorry if I’m making this too complicated, I’m not that great at scripting XD

aaa
It’s simple, there’s no requiring anything. When buying a hat just return a table that I’ve listed above to fix your issue.

So I would do something like

(idk if i should use a local) unboxedhat = {}

unboxedhat =
{
	hat = [hat.Name]
	rarity = [rarity]
}