On line 13, it fails. I've tried to make the 'Shirt' class an ObjectValue, currently a StringValue, but it would give another error saying that line 15: bad argument #2 to '?' (string expected, got Object). How can I fix this?
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local Shirt = player:WaitForChild("Shirt")
local shirtFolder = game:GetService("ReplicatedStorage"):WaitForChild("Shirts")
local shirts = {}
local Count = 1
local LB = script.Parent:WaitForChild("Left")
local RB = script.Parent:WaitForChild("Right")
function Update()
script.Parent.Parent.Parent:WaitForChild("TitleShirt").Text = shirts[Count].Name
Shirt.Value = shirts[Count]
local clone = game.ReplicatedStorage.Shirts[Shirt.Value]:Clone()
player.Character.Shirt:Remove()
clone.Parent = player.Character
end
for i,v in pairs(shirtFolder:GetChildren()) do
table.insert(shirts,v)
end
LB.MouseButton1Click:connect(function()
if Count > 1 then
Count = Count - 1
Update()
end
end)
RB.MouseButton1Click:connect(function()
if Count >= #shirts then
else
Count = Count + 1
Update()
end
end)
