I’m trying to make a Character customization system that allows you to preview the look you put together before firing the changes to all clients.
When you click on the “Customize” button, a LocalScript will create a copy of the LocalPlayer’s character, position it on top of a part, and at the same time move the LocalPlayer’s camera in front of the preview dummy.
A GUI with a TextBox area will show up, where you’ll be able to input the accessories, shirts, and pants’ IDs and these will load on the dummy (using insertService) to show how it looks.
My issue is: for some reason the script seems unable to either detect the Dummy or insert the items inputted via ID with the GUI.
The script gives no errors, so it’s much harder for me to figure out what the issue is…
local insertS = game:GetService("InsertService")
local player = game.Players.LocalPlayer
--Input ID
script.Parent.FocusLost:Connect(function()
if tonumber(script.Parent.Text) then
return tostring(script.Parent.Text)
end
end)
--Insert accessory
local number = tostring(script.Parent.Text)
if not number then return end
local asset
local char = player.Character
local dummy = game.Workspace:FindFirstChild("DummyPreview")
local success = pcall(function()
asset = insertS:LoadAsset(number)
end)
if not success then return end
local child = asset:GetChildren()
for _,v in pairs(child) do
if v:IsA("Accessory") then
dummy.Humanoid:AddAccessory(v)
elseif v:IsA("Shirt") then
local templ = v.ShirtTemplate
dummy.Shirt.ShirtTemplate = templ
elseif v:IsA("Pants") then
local temp1 = v.PantsTemplate
dummy.Pants.PantsTemplate = temp1
elseif v:IsA("Decal") then
dummy.Head:FindFirstChildOfClass("Decal").Texture = v.Texture
end
end
asset:Destroy()
Apologies for the lack of information, I’ve been fighting with this problem for almost 2 days and nothing seems to work.