Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom Character Gui Local Script Problem?

Asked by 6 years ago
Edited 6 years ago

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)
0
^ Please use codeblock. Axceed_Xlr 380 — 6y
0
@Axceed_Xlr Sorry, about that sparkevin 36 — 6y

1 answer

Log in to vote
0
Answered by
uhTeddy 101
6 years ago

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)
0
@Trxx_x Thanks for resposting in codeblock format! sparkevin 36 — 6y
Ad

Answer this question