Wig Colour Gui Script

if script.Parent.Faces.Visible == false then
script.Parent.Faces.Visible = true
script.Parent.Frame.Frame["Open/Close"].Text = "Close Hair Colour Changer"
script.Parent.Faces.Title.Visible = true
else
script.Parent.Faces.Visible = false
script.Parent.Frame.Frame["Open/Close"].Text = "Open Hair Colour Changer"
end
end)

local player = script.Parent.Parent.Parent
local f = script.Parent.Faces.Page1:GetChildren()
local bvalue = script.Parent.Faces.Page1.face.Value.Value
for i=1,#f do
local face = f[i]
if face.Name == "face" then
face.MouseButton1Down:connect(function()
local children = player.Character.Hat:GetDecendants()
for i = 1, #children do
	local item = children[i]
	if item:IsA("SpecialMesh") then
		item.VertexColor = Vector3.new(bvalue)
		print(item.VertexColor)
	end
end
end)
end
end


image

You will need to clarify this to me because you decided to draw all over your images, but is this a screengui that the player will use to change an item they are wearing?

1 Like

So basically it’s a GUI where this a text button that says Blonde and when you click it it’s supposed to change the wig you currently have on to be blonde. The wigs are already in the game and working however i want to make to so they can be coloured different colours, but for some reason the script above is printing out 0,0,0 instead of the vertex value that’s inside the vector3 value.

GUIs should use LocalScripts instead of regular Scripts and you will need to use RemoveEvents for the LocalScripts to communicate information to the server. I suggest reading these articles on LocalScripts, RemoteEvents, and Functions as these all tie together to make the GUI you want.

Remote Events: Custom Events and Callbacks | Documentation - Roblox Creator Hub
Functions: Functions | Documentation - Roblox Creator Hub
LocalScripts: LocalScript | Documentation - Roblox Creator Hub

2 Likes

Okay, Thank you for all your help :slight_smile:

I figured out how to do it and it works for the client only for now, but i can make it a remote event so everyone will see it.

item.VertexColor = Vector3.new(bvalue)
print(item.VertexColor)

Change that to

item.VertexColor = bvalue
print(item.VertexColor)

No need for the damn rudeness! I am new to this and have just found out how to do ```.

Thank you to everyone for the help, i’ve added a remote event in a changed the script and it’s now functionally :slight_smile:

image