#Issue with applying clothes via GUI

1 messages · Page 1 of 1 (latest)

blazing forge
#

Hi everyone, I’m creating a GUI to let players change their character’s clothes in Roblox.
I have two buttons, Red and Blue, that should apply a set of clothes (shirt and pants) to the character, but when I click them, the character stays naked instead of wearing the clothes.

Can someone help me figure out what I’m doing wrong or what’s missing in the code to properly apply the clothes?

Thanks in advance! 🙏

#

This is the structure

rare lance
# blazing forge Here is the code

try wait a short moment before parenting it

task.wait(0.1)
newClothing.Parent = char

and ensuring the charatcer is fully loaded

local char = player.Character or player.CharacterAdded:Wait()
char:WaitForChild("HumanoidRootPart")

#

you can also create print stattements for debugging

print("Creating Shirt with ID:", data.Shirt)
print("Creating Pants with ID:", data.Pants)

blazing forge
#

Thx so much, basically before I noted that was only client side
Now I fixed this but still remaining the problem of before
Anyway, I can adapt your fix in my script right?

blazing forge
#

Ok

rare lance
#

😁

blazing forge
#

@rare lance idk where I need to change that ahaha

#

Im so confusedd

#

This is my script rn (server side)

rare lance
# blazing forge
    local data = Costumes.Red
    saveOriginal()

    local char = player.Character or player.CharacterAdded:Wait()
    char:WaitForChild("HumanoidRootPart")

    removeClothing(char)

    task.wait(0.1)  -- ensure engine registers change

    equipClothing("Shirt", data.Shirt)
    equipClothing("Pants", data.Pants)
    print("✅ Costume applied:", data.Shirt, data.Pants)

    gui.Enabled = false
end)```
blazing forge
#

Thx so much 🙏

#

Now I try

rare lance
#

dont thank me unless it works xd

strange urchinBOT
#

studio** You are now Level 6! **studio

blazing forge
rare lance
#

ok

#

make sure if its a local script or serverside script

blazing forge
#

I only have a problem

#

As you can see the gui is client side

#

It gives me warning

rare lance
blazing forge
rare lance
#

you could add a serverside script handler

#

ur only firing ChangeCostume in your local script , but there is no server-side listener receiving it

blazing forge
#

Idk how to do that

#

Btw another thing
When it changes the things

rare lance
#
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local Costumes = {
    Red = {
        Shirt = "rbxassetid://6703898555",
        Pants = "rbxassetid://14606271478"
    },
    Blue = {
        Shirt = "rbxassetid://6231673345",
        Pants = "rbxassetid://185998212"
    }
}

local ChangeEvent = Instance.new("RemoteEvent")
ChangeEvent.Name = "ChangeCostume"
ChangeEvent.Parent = RS

ChangeEvent.OnServerEvent:Connect(function(player, choice)
    local data = Costumes[choice]
    if not data then return end

    local char = player.Character or player.CharacterAdded:Wait()
    
    -- Remove old clothes
    for _, obj in ipairs(char:GetChildren()) do
        if obj:IsA("Shirt") or obj:IsA("Pants") then
            obj:Destroy()
        end
    end

    -- Apply new clothes server-side
    local shirt = Instance.new("Shirt", char)
    shirt.ShirtTemplate = data.Shirt
    local pants = Instance.new("Pants", char)
    pants.PantsTemplate = data.Pants
end)```

try place this in ServerScriptService
blazing forge
#

It changes all the thing on the explorer but I cannot see on the game

blazing forge
#

Sure

#

Nothing man :((

#

Btw I'm noticing one thing

#

Actually It changes the id on the explorer

#

But idk why it doesn't load

cloud grail
#

having same exact issue wtf

cloud grail
#

bump bro

cloud grail
#

bump