I’m trying out InsertService on a OnServerEvent, but keep running into the error “Argument 1 is missing or nil” whenever it is activated. For context, this is apart of a character customization system I’ve been working on for my game. I’ve looked for solutions across the forums but haven’t found anything more applicable to my scenario, or at least so I think. Any help figuring this out will be appreciated!
LocalScript
shirts.NameButton.Activated:Connect(function()
clothingEvent:FireServer(player, "Customization")
renderPlayer()
end)
ServerScript
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")
local pants = character:WaitForChild("Pants")
print(character:GetChildren())
shirt.ShirtTemplate = InsertService:LoadAsset(tonumber(clothesData.Asset)).Shirt.ShirtTemplate
print("Changed shirt to:", clothesData.DisplayName)
clothingEvent:FireClient(player, "Customization")
end)