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

Why isn't my shirt change Gui working?

Asked by 8 years ago

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

Log in to vote
-3
Answered by 8 years ago
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)

0
Thank you so much! Squidier 40 — 8y
0
Yep! thehybrid576 294 — 8y
Ad

Answer this question