Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Custom Character Gui Local Script Problem?


I'm trying to make a custom character gui and I've been watching different tutorials as reference for what I want to do with it and how I want it edited. But, I've come to a pause because I can't seem to figure out why the Value's aren't changing and the buttons within the gui aren't working :/ All suggestions and ideas are welcome. Thanks!

This is what my Local Script looks like rn:


local player = script.Parent.Parent.Parent.Parent.Parent
local Hat = player:WaitForChild("Hat")
local HatFolder = game:GetService("ReplicatedStorage"):WaitForChild('Hats')

local Hats = {}

local hat1 = script.Parent:WaitForChild('Hat1Button')
local hat2 = script.Parent:WaitForChild('Hat2Button')
local hat3 = script.Parent:WaitForChild('Hat3Button')

local toggle = false


function Update()
	script.Parent:WaitForChild('HatName').Text = Hat.Value
	wait(0.01)
end


hat1.MouseButton1Down:connect(function()
	if toggle == false then
		script.Parent.HatName.Text = "Hat1"
		wait(0.01)
		script.Parent.Wear1.Visible = true
		script.Parent.Wear2.Visible = false
		script.Parent.Wear3.Visible = false
		Update()
	end
end)


hat2.MouseButton1Down:connect(function()
	if toggle == false then
		script.Parent.HatName.Text = "Hat2"
		wait(0.01)
		script.Parent.Wear1.Visible = false
		script.Parent.Wear2.Visible = true
		script.Parent.Wear3.Visible = false
		Update()
	end
end)


hat3.MouseButton1Down:connect(function()
	if toggle == false then
		script.Parent.HatName.Text = "Hat3"
		wait(0.01)
		script.Parent.Wear1.Visible = false
		script.Parent.Wear2.Visible = false
		script.Parent.Wear3.Visible = true
		Update()
	end
end)

repeat wait() until game.Workspace.CurrentCamera
local camera = game.Workspace.CurrentCamera

local character = game:GetService('ReplicatedStorage'):WaitForChild('CustomCharacter'):Clone()

local player = game.Players.LocalPlayer

local Hat = player:WaitForChild("Hat")
local Shirt = player:WaitForChild("Shirt")
local Pants = player:WaitForChild("Pants")

character.Parent = camera



function Update()
	for i,v in pairs(character:GetChildren()) do
		if v:IsA("Hat") or v:IsA("Pants") or v:IsA("Shirt") then
			v:remove()
		end
	end
	
	Hat.Value:Clone().Parent = character
	Shirt.Value:Clone().Parent = character
	Pants.Value:Clone().Parent = character
	
end


Hat.Changed:connect(function()
	Update()
end)

Shirt.Changed:connect(function()
	Update()
end)

Pants.Changed:connect(function()
	Update()
end)

2 comments

0

^ Please use codeblock.

0

@Axceed_Xlr Sorry, about that

1 answer

This is not an answer simply the use of a codebox for other people who want it

local player = script.Parent.Parent.Parent.Parent.Parent local Hat = player:WaitForChild("Hat") local HatFolder = game:GetService("ReplicatedStorage"):WaitForChild('Hats')

local Hats = {}

local hat1 = script.Parent:WaitForChild('Hat1Button') local hat2 = script.Parent:WaitForChild('Hat2Button') local hat3 = script.Parent:WaitForChild('Hat3Button')
local toggle = false

function Update() script.Parent:WaitForChild('HatName').Text = Hat.Value wait(0.01) end
hat1.MouseButton1Down:connect(function() if toggle == false then script.Parent.HatName.Text = "Hat1" wait(0.01) script.Parent.Wear1.Visible = true script.Parent.Wear2.Visible = false script.Parent.Wear3.Visible = false Update() end end)
hat2.MouseButton1Down:connect(function() if toggle == false then script.Parent.HatName.Text = "Hat2" wait(0.01) script.Parent.Wear1.Visible = false script.Parent.Wear2.Visible = true script.Parent.Wear3.Visible = false Update() end end)
hat3.MouseButton1Down:connect(function() if toggle == false then script.Parent.HatName.Text = "Hat3" wait(0.01) script.Parent.Wear1.Visible = false script.Parent.Wear2.Visible = false script.Parent.Wear3.Visible = true Update() end end)

1 comment

0

@Trxx_x Thanks for resposting in codeblock format!

This discussion is preserved as it was. New answers, comments, and votes are closed.