#Shirt is not a valid member of Model "Model"

1 messages · Page 1 of 1 (latest)

opaque oracle
#
local InsertService = game:GetService("InsertService")

local clothingEvent = game.ReplicatedStorage.remoteEvents.clothingEvent
local clothesData = require(game.ReplicatedStorage.Modules.Data.clothesData)

clothingEvent.OnServerEvent:Connect(function(player, eventtype)
    local character = player.Character
    local shirt = character:WaitForChild("Shirt")
    if eventtype == "Customization" then
        for clothesName, clothingData in clothesData do
            shirt.ShirtTemplate = InsertService:LoadAsset(tonumber(clothingData.Asset)).Shirt.ShirtTemplate
        end
    end
end)``` I'm trying to utilize a remote event for my character customization system, but it keeps returning the error code ``Shirt is not a valid member of Model "Model"`` whenever it fires. Might anyone be able to help me solve this? Thanks in advance!
low palm
#

its saying InsertService:LoadAsset(tonumber(clothingData.Asset)).Shirt is nil

opaque oracle
low palm
#

moreover, why don't you know?

#

have you checked?

#

clearly not.

#

go check.

opaque oracle
low palm
opaque oracle
low palm
#

i classify this one in the same category as having to ask "are you getting any errors?" twice because you didn't check the output window

#

and then i have to ask you to screenshot the output window because you didn't read it

#

why is it the same category?

#

screenshot your "check" -_-

low palm
opaque oracle
#

How do you know that?

low palm
#

i'm a wizard

opaque oracle
#
local InsertService = game:GetService("InsertService")

local clothingEvent = game.ReplicatedStorage.remoteEvents.clothingEvent
local clothesData = require(game.ReplicatedStorage.Modules.Data.clothesData)

clothingEvent.OnServerEvent:Connect(function(player, eventtype)
    local character = player.Character
    local shirt = character:WaitForChild("Shirt")
    if eventtype == "Customization" then
        for clothesName, clothingData in clothesData do
            shirt.ShirtTemplate = InsertService:LoadAsset(tonumber(clothingData.Asset)).Shirt.ShirtTemplate
            print(player:GetChildren())
        end
    end
end)```
low palm
#

your check is wrong

#

what is the assetid of the shirt you're trying to check here

opaque oracle
#

The assetid is 382538059

#

I originally had it set with rbxasset:// at the front but even with a tonumber it wouldnt work

low palm
#

well nope its not that one

#

why is this a for loop

#
        for clothesName, clothingData in clothesData do
            shirt.ShirtTemplate = ...
        end```
#

are you intending on changing the shirt 100 times in one go?

opaque oracle
#

No thats my bad

low palm
#

why are you flipping through every shirt in your clothesdata

opaque oracle
low palm
opaque oracle
low palm
#

also joy you now know at least one of the ids in there does not fit your expected output

low palm
opaque oracle
#

I thought it would work

#

🌚

low palm
#

sadly computers aren't mystical mind-readers just yet, maybe in a few years. but for now you need to be explicit about literally everything

opaque oracle
#

So if its not a loop that should be used what should I write in its place?

low palm
#

bruh agony

opaque oracle
#

I only knew about the loop method allowing for the asset number to be called from another script I had written

low palm
#

one shirt

#

not let's see all of them at once

#

so i would probably expect the client to include the desired shirt in their :FireServer

#

and then on server you check if it actually exists, if they can wear that specific shirt etc

#

how you solve that is up to you.

low palm
#

which one is a task left up to you to figure out

proven latch
#

chat whats a pcall