I’ve been making a character loading system, and I’m really stuck.
Basically, I have an “If” statement inside of a loop looping through data. The prints inside of the “If” statements are being called, and the parent is printing correctly, but the pants are not visible in the explorer.
I don’t know if this is a bug, or if I’m just missing something really obvious that I should have seen, but I’m providing the script that adds the pants and the place file for help.
The Script
--Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--Remotes
local sendTeleportDataEvent = ReplicatedStorage:WaitForChild("SendTeleportData")
--Modules
local customizationOptionsModule = require(7902172329).CustomizationsTable
print(customizationOptionsModule)
sendTeleportDataEvent.OnServerEvent:Connect(function(player,data)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
for section, choice in pairs(data) do
print(section)
for _, descendant in pairs(character:GetDescendants()) do
if descendant:IsA("Shirt") or descendant:IsA("Pants") then
descendant:Destroy()
end
end
if section == "Shirts" then
local newShirt = Instance.new("Shirt")
newShirt.ShirtTemplate = customizationOptionsModule.Shirts[choice]
newShirt.Parent = character
print(newShirt)
elseif section == "Pants" then
print("Pants")
local newPants = Instance.new("Pants")
print(customizationOptionsModule.Pants[choice])
newPants.PantsTemplate = customizationOptionsModule.Pants[choice]
newPants.Parent = character
print(newPants.Parent)
end
end
end)
customization.rbxl (47.5 KB)