Ik the title is misleading but there is no way to say this otherwise.

so I have a script that when a player clicks on a certain part of the body will change what part they are editing but no matter the part selected it only will edit the head of the player.

--Variables
local h = script.Parent.Parent.Parent.edit_label.Part.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(27, 42, 53)
	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(27, 42, 53)
	end)
end
--larm
if h == "Larm" then
	script.Parent.MouseButton1Click:connect(function()
		game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
		script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(27, 42, 53)
	end)
end
--rarm
if h == "Rarm" then
	script.Parent.MouseButton1Click:connect(function()
		game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
		script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(27, 42, 53)
	end)
end
--lleg
if h == "Lleg" then
	script.Parent.MouseButton1Click:connect(function()
		game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
		script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(27, 42, 53)
	end)
end
--rleg
if h == "Rleg" then
	script.Parent.MouseButton1Click:connect(function()
		game.Players.LocalPlayer.Data.headcolor.Value = script.Parent.Name
		script.Parent.Parent.Parent.Hat.BackgroundColor3 = Color3.fromRGB(27, 42, 53)
	end)
end

9 comments

0

i want you to read this, then correct your grammar for me. "so I have a script that when a player clicks on a certain part of the body will change what part they are editing but no matter the part selected it only will edit the head of the player."

0

You need to explain the issue a bit better.

0

You didn't change "headcolor" or "Hat" in any of the other if statements. You also don't need a different click connection for every if statement.

0

I did change it before this with another script that i had scrapped and gave the same results

0

this post is basically dead ;c

0

You want to use if and elseif. And it seems to only be setting the headcolor value. There's so much repetition that you could shorten everything to about 6 lines of code

0

Where is this script located; where is it parented to?

0

Not gonna answer bc I barely looked but since you make a permanent connection every time those connections interfere. you need to fix that