Hello, I have made another topic related to this script but now Its different, since this time it just says that the Shirt object is nil in the character, could I get some help? And here is the code:
-- // Variables \\ --
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local _ClothingLibrary = require(script.ClothingLibrary)
-- // Main Code \\ --
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if Player:GetRankInGroup(4178207) == 6 or 7 or 9 then -- Hostpitality Outfit
Character:WaitForChild("Shirt").ShirtTemplate = _ClothingLibrary.Low_Rank.Shirt
Character:WaitForChild("Pants").PantsTemplate = _ClothingLibrary.Low_Rank.Pants
elseif not Character:WaitForChild("Shirt") and Player:GetRankInGroup(4178207) == 6 or 7 or 9 then
local Shirt = Instance.new("Shirt", Character)
Shirt.ShirtTemplate = _ClothingLibrary.Low_Rank.Shirt
elseif not Character:WaitForChild("Pants") and Player:GetRankInGroup(4178207) == 6 or 7 or 9 then
local Shirt = Instance.new("Pants", Character)
Shirt.ShirtTemplate = _ClothingLibrary.Low_Rank.Pants
elseif Player:GetRankInGroup(4178207) == 8 then -- Chef Outfit
Character:WaitForChild("Shirt").ShirtTemplate = _ClothingLibrary.Culinary.Shirt
Character:WaitForChild("Pants").PantsTemplate = _ClothingLibrary.Culinary.Pants
end
end)
end)
Attempt to index nil with 'Shirt' either means that the Low_Rank key doesn’t exist in the table, or the character doesn’t. The latter is unlikely since you’re using CharacterAdded.