I've been trying for literally 3 hours now and i'm probably the stupidest person in this place right now but what am I doing wrong with this script???
local h = script.Parent.Parent.Parent.edit_label.Part.Value
local d = game.Players.LocalPlayer.Data
local c = script.color.Value
local n = script.Parent.Name
local head = script.Parent.Parent.Parent.Hat
local torso = script.Parent.Parent.Parent.Torso
local larm = script.Parent.Parent.Parent.Larm
local rarm = script.Parent.Parent.Parent.Rarm
local lleg = script.Parent.Parent.Parent.Lleg
local rleg = script.Parent.Parent.Parent.Rleg
script.Parent.MouseButton1Click:connect(function()
if h == "head" then
head.BackgroundColor3 = Color3.fromRGB(c)
d.headcolor = n
if h == "torso" then
torso.BackgroundColor3 = Color3.fromRGB(c)
d.torsocolor = n
end
end
end)
this is a fraction of the script and it wont even work, but what it is supposed to do is check which part of the body the player is editing and if it is that part of the body to change that color, but every time I do this it will only change the head or change nothing.
if anyone can actually fix this I will praise you.

2 comments
Do you want to change the vars "h,n,c" during the game? If yes, you should set it on player click
I suggest you clean up your variables by creating a new one that points to script.Parent.Parent.Parent directly.