So I have something that lets you change colors of a character but I need it to check whether they selected the head or the torso or left arm... but I can't find out how to loop check it (yes I have tried while true do)
--Variables
local h = script.Parent.Parent.Parent.edit_label.Part.Value
local c = script.color.Value
--head
if h == "Head" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end
--torso
if h == "Torso" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end
--larm
if h == "Left arm" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end
--rarm
if h == "Right arm" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end
--lleg
if h == "Left leg" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end
--rleg
if h == "Right leg" then
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(c)
end)
end

1 comment
And don't worry about "Part" thinking its actually a Part, it's just a string value I had no name for.