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

Why isn't my shirt change Gui working?

Recently go into scripting and wanted to make a character customization menu as my first project, but I can't get it to work. Sorry if there are any obvious errors that I didn't notice!

local plr = script.Parent.Parent.Parent.Parent.Parent
local humanoid = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Humanoid")

function onClicked()
	if humanoid ~= nil then
		local shirtchange1 = game.ReplicatedStorage.Shirt1:clone()
		shirtchange1.Parent = plr
		if shirtchange1.Parent == plr then
			plr:FindFirstChild("Shirt"):Destroy()
		end
		
	end
end

script.Parent.MouseButton1Click:connect(onClicked)

1 answer

local plr = game.Players.LocalPlayer --Finds the player who launches this script
local physicalplr = game.Workspace[plr.Name] -- finds the player in workspace
local humanoid =physicalplr:findFirstChild("Humanoid") --finds the humanoid in the player

function onClicked()
    if humanoid ~= nil then
        local shirtchange1 = game.ReplicatedStorage.Shirt1:clone()
        shirtchange1.Parent = physicalplr
        if shirtchange1.Parent == physicalplr then
            physicalplr:findFirstChild("Shirt"):Destroy()
        end

    end
end

script.Parent.MouseButton1Click:connect(onClicked)

2 comments

0

Thank you so much!

0

Yep!

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