for some reason the miniature that gets sent to your startergear doesnt have the variant…
- User
for some reason the miniature that gets sent to your startergear doesnt have the variant name like a winged zombie is shown as "winged zombie" in the backpack but as "zombie" in startergear but it still has the variant's features
local module = {} local ServerStorage = game:GetService("ServerStorage") local Props = ServerStorage:WaitForChild("Props") local Miniatures = Props:WaitForChild("Miniatures") local partHeadTemplate = script:WaitForChild('PartHeadTemplate') local enemies = require(script.Parent:WaitForChild("Enemies")) local Damage = require(script.Parent:WaitForChild("Dano")) local CS = game:GetService("CollectionService") module.applyBundle = function(character, bundleFolder, rigTypeName) local humanoid = character.Humanoid humanoid:RemoveAccessories() humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false) for _,asset in pairs(bundleFolder:clone():GetChildren()) do for _,child in pairs(asset:GetChildren()) do if child:IsA("Folder") and child.Name == rigTypeName then for _, bodyPart in pairs(child:GetChildren()) do local old = character:FindFirstChild(bodyPart.Name) if old then old:Destroy() end bodyPart.Parent = character humanoid:BuildRigFromAttachments() end elseif child:IsA("Accessory") or child:IsA("CharacterAppearance") or child:IsA("Tool") then child.Parent = character elseif child:IsA("Decal") and (child.Name == 'face' or child.Name == 'Face') then local head = character:FindFirstChild('Head') if head then for _,headChild in pairs(head:GetChildren()) do if headChild and (headChild.Name == 'face' or headChild.Name == 'Face') then headChild:Destroy() end end child.Parent = head end elseif child:IsA('SpecialMesh') then local head = character:FindFirstChild('Head') if head then if head:IsA('MeshPart') then -- Replace meshPart with a head part local newHead = partHeadTemplate:clone() newHead.Name = 'Head' newHead.Color = head.Color for _,v in pairs(head:GetChildren()) do if v:IsA('Decal') then v.Parent = newHead end end head:Destroy() newHead.Parent = character humanoid:BuildRigFromAttachments() head = newHead end for _,headChild in pairs(head:GetChildren()) do if headChild and headChild:IsA('SpecialMesh') then headChild:Destroy() end end child.Parent = head end else print('Not sure what to do with this class:', child.ClassName) end --todo: handle animations end end humanoid:BuildRigFromAttachments() humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, true) end module.Explosion = function(owner, damageOwner, stat) local damageType = "zombie" local soundid = "rbxassetid://12222084" if stat["Sound"] then soundid=stat["Sound"] end if stat["DamageType"] then damageType = stat["DamageType"] end --stat = {["Size"]=#;["Damage"]=#;["Position"];["Color"];["Duration"]} damageOwner = damageOwner or false local isplayer = false if game.Players:GetPlayerFromCharacter(owner) ~= nil then isplayer=true end local explosion = Instance.new("Part") explosion.Shape = "Ball" explosion.Position = stat["Position"] explosion.Size = Vector3.new(1,1,1) explosion.CanCollide=false explosion.Anchored=true explosion.Material="Neon" explosion.Color = stat["Color"] explosion.Parent = workspace.Delete local sound = Instance.new("Sound",explosion) sound.SoundId = soundid sound:Play() game.TweenService:Create(explosion,TweenInfo.new(stat["Duration"]),{Size=stat["Size"],Transparency=1}):Play() game.Debris:AddItem(explosion,stat["Duration"]+sound.TimeLength) local overlapparams = OverlapParams.new() overlapparams.FilterDescendantsInstances = {} overlapparams.FilterType = Enum.RaycastFilterType.Exclude if damageOwner == false then overlapparams.FilterDescendantsInstances = {owner} end if isplayer == true then local tablee = overlapparams.FilterDescendantsInstances local plrs = game:GetService("Players"):GetChildren() for i = 1, #plrs do if plrs[i].Character ~= nil then table.insert(tablee,plrs[i].Character) end end overlapparams.FilterDescendantsInstances = tablee else local tablee = overlapparams.FilterDescendantsInstances local enemies = workspace.Enemies:GetChildren() for i = 1, #enemies do table.insert(tablee,enemies[i]) end overlapparams.FilterDescendantsInstances = tablee end local around = workspace:GetPartBoundsInBox(explosion.CFrame,stat["Size"], overlapparams) for i = 1, #around do local part = around[i] if not part.Parent or not part.Parent:FindFirstChild("Humanoid") then continue end print("DAMAGE") local hum = part.Parent.Humanoid Damage.Damage(owner, hum.Parent, damageType, stat["Damage"]) if damageType == "fire" then hum.Parent:SetAttribute("OnFire",3) CS:AddTag(hum.Parent, "OnFire") end end end module.giveMiniature = function(plr, variant1, variant2, name) print(name) local miniature = Miniatures:FindFirstChild(name) if miniature == nil then return end miniature = miniature:Clone() local handle = miniature:FindFirstChild("Handle") if not handle then return end local model = handle:FindFirstChildOfClass("Model") if not model then return end miniature.Parent = plr:FindFirstChild("Backpack") enemies.Varia(model, name, variant1, variant2, "miniatura") local miniature2 = miniature:Clone() miniature2.Parent = plr.StarterGear local handle = miniature2:FindFirstChild("Handle") if not handle then return end local model = handle:FindFirstChildOfClass("Model") if not model then return end enemies.Varia(model, name, variant1, variant2, "miniatura") return miniature end return modulelocal module = {} local ServerStorage = game.ServerStorage local variantes = require(script.Parent:WaitForChild("Variantes")) local Monsters = ServerStorage:WaitForChild("Monsters") local Bosses = ServerStorage:WaitForChild("Bosses") local MessagingService = game:GetService("MessagingService") MessagingService:SubscribeAsync("RarityKill", function(message) game.ReplicatedStorage.Remotes.SystemChat:FireAllClients(message.Data.DisplayName, message.Data.Creature, message.Data.Rarity) end) local function calcTotals(categoria1, categoria2) local total1 = 0 local total2 = 0 for i,bagulha in pairs(categoria1) do total1=total1+bagulha.weight end for i,bagulha in pairs(categoria2) do total2=total2+bagulha.weight end print("DEBUG: total1 =", total1, "total2 =", total2) -- Add this return total1, total2 end local function chanceEmTantos(weight, totalWeight, categoriaChance) --categoriaChance 1 se categoria1, 5 de categoria2 print(totalWeight, weight, categoriaChance) return totalWeight / weight * categoriaChance end local function chance1in(var1Data , var1Cat, var2Data , var2Cat, cat1, cat2) local total1, total2 = calcTotals(cat1, cat2) local function singleChance(vData, catRef) local mult = (catRef == cat2) and 5 or 1 local total = (catRef == cat2) and total2 or total1 return chanceEmTantos(vData.weight, total, mult) end if not var2Data then return singleChance(var1Data, var1Cat) end return math.floor( singleChance(var1Data, var1Cat) * singleChance(var2Data, var2Cat) + 0.5) end function module.GetRandomMonster(weightTable) -- calcula o peso total local totalWeight = 0 for name, data in pairs(weightTable) do totalWeight = totalWeight + (data.weight or 0) end if totalWeight <= 0 then warn("GetRandomMonster: totalWeight inválido (" .. tostring(totalWeight) .. ")") return nil end -- obtém um número aleatório entre 1 e totalWeight local pick = math.random(1, totalWeight) -- percorre até que o valor acumulado alcance pick local accumulated = 0 for name, data in pairs(weightTable) do accumulated = accumulated + data.weight if pick <= accumulated then return name end end -- fallback (não deveria acontecer) return nil end module.ChanceByName = function(monsterName, variantName1, variantName2) -- pull the pools (same call you already do elsewhere) local pools = variantes.Variantes() local cat1,cat2 = pools.Category1, pools.Category2 -- helper: find the data table + its category given a variant name local function findVariant(name) if not name then return nil,nil end -- caller passed nil for _,cat in pairs({cat1,cat2}) do if cat[name] then return cat[name], cat end end return nil,nil -- name not found end local v1, catV1 = findVariant(variantName1) local v2, catV2 = findVariant(variantName2) if not v1 and not v2 then -- none found? bail warn("ChanceByName: no valid variants for "..monsterName) return nil end -- *** reuse the generic function we wrote earlier *** return chance1in(v1 , catV1, v2 , catV2, cat1, cat2) -- real totals end local function pick(pool) -- raridade? local total, r = 0, math.random() for _,def in pairs(pool) do total += def.weight or 0 end r *= total for name,def in pairs(pool) do r -= def.weight if r <= 0 then return name end end end module.Varia = function(npc, monsterName, variant1, variant2, miniatura) local randomvariant1 = nil local randomvariant1Categoria = nil local randomvariant2 = nil local randomvariant2Categoria = nil local times = 0 print(variant1) print(variant2) if variant1 == nil and variant2 == nil and miniatura == nil then local todasCategorias = variantes.Variantes(monsterName) local cat1 = todasCategorias.Category1 local cat2 = todasCategorias.Category2 local alreadyCategory2 = false local chosen = cat1 if math.random(1,5) == 1 then times = 1 if math.random(1,10) == 1 then times = 2 end end for i = 1, times do if math.random(1,5) == 1 and chosen ~= cat2 then chosen = cat2 else chosen = cat1 end local todasVariantes = chosen if todasVariantes then local variantName = pick(todasVariantes) local variantScript = todasVariantes[variantName].variante if variantScript then local scrip = script.Parent.VariantesScripts:FindFirstChild(variantScript) if not scrip then warn("nao tem isso no variantesscript "..variantScript) return end require(scrip).Variar(npc) end if randomvariant1 == nil then randomvariant1 = todasVariantes[variantName] randomvariant1Categoria = chosen else randomvariant2 = todasVariantes[variantName] randomvariant2Categoria = chosen end end end if randomvariant1 ~= nil then local chance = chance1in(randomvariant1, randomvariant1Categoria,nil, nil, cat1, cat2) print("1 em "..chance) return chance elseif randomvariant2 ~= nil then local chance = chance1in(randomvariant2, randomvariant2Categoria,nil, nil, cat1, cat2) print("1 em "..chance) return chance end else --CUSTOM VARIANTE print("custom") local todasCategorias = variantes.Variantes(monsterName) local cat1 = todasCategorias.Category1 local cat2 = todasCategorias.Category2 local VarianteTrue1 = nil local VarianteTrue2 = nil local VarianteTrue1Cat = nil local VarianteTrue2Cat = nil local function VARIANTE(variantThis) -- Use the existing cat1, cat2 instead of creating new ones for _,cat in pairs({cat1, cat2}) do -- Changed this line for vName,vData in pairs(cat) do if vName == variantThis then -- aplica script local scriptName = vData.variante if scriptName then require(script.Parent.VariantesScripts[scriptName]).Variar(npc) end -- salva if not VarianteTrue1 then VarianteTrue1, VarianteTrue1Cat = vData, cat else VarianteTrue2, VarianteTrue2Cat = vData, cat end return end end end end if variant1 then VARIANTE(variant1) end if variant2 then VARIANTE(variant2) end if VarianteTrue1 and VarianteTrue2 then local chance = chance1in(VarianteTrue1 , VarianteTrue1Cat, VarianteTrue2 , VarianteTrue2Cat, cat1, cat2) print("1 em "..chance) return chance elseif VarianteTrue1 then local chance = chance1in(VarianteTrue1 , VarianteTrue1Cat, nil , nil, cat1, cat2) print("DEBUG: VarianteTrue1Cat == cat1:", VarianteTrue1Cat == cat1) print("DEBUG: VarianteTrue1Cat == cat2:", VarianteTrue1Cat == cat2)print("1 em "..chance) return chance elseif VarianteTrue2 then local chance = chance1in(VarianteTrue2 , VarianteTrue2Cat, nil , nil, cat1, cat2) print("1 em "..chance) return chance end end end module.Summon = function(monsterName, position, variant1, variant2) local npc = nil task.spawn(function() npc = Monsters:FindFirstChild(monsterName) print("que") if not npc then warn("monstro n existe veir "..monsterName) npc = Bosses:FindFirstChild(monsterName) if not npc then return end end npc = npc:Clone() print("que") local brain = npc:FindFirstChild("Celebro") if not brain then return end local chance = module.Varia(npc, monsterName, variant1, variant2) print("que") local variant1 = npc:GetAttribute("Variant1") or "" local variant2 = npc:GetAttribute("Variant2") or "" local name = npc.Name npc:SetAttribute("Type", name) print("que") local function nameThingAndPaint(npc, name, variant1, variant2) if npc.Parent ~= nil and npc.Parent.Name == "Handle" then npc.Parent.Parent:SetAttribute("Variant1",variant1) npc.Parent.Parent:SetAttribute("Variant2",variant2) if chance then npc.Parent.Parent:SetAttribute("Rarity",chance) end end if variant1 == nil then variant1 = "" end if variant2 == nil then variant2 = "" end variant1 = variant1:sub(1,1):upper() .. variant1:sub(2) or "" variant2 = variant2:sub(1,1):upper() .. variant2:sub(2) or "" local name = npc.Name name = variant1.." "..variant2.." "..name name = name:gsub("%s+", " "):gsub("^%s+", ""):gsub("%s+$", "") --removes double spaces npc.Name = name if npc.Parent ~= nil and npc.Parent.Name == "Handle" then npc.Parent.Parent.Name = name end if variant1 ~= "" or variant2 ~= "" then print("NAME") local nameText = npc:FindFirstChild("MonsterName") if nameText ~= nil then local function strokeColor(thing) for i,v in pairs(nameText.Variety:GetChildren()) do if v:FindFirstChild("UIStroke") then v.UIStroke.Color = thing end end end local chanceLouca = math.floor(chance+0.5) nameText.Normal.Visible = false nameText.Variety.Visible = true nameText.Variety.MonsterName.Text = name nameText.Variety.Rarity.Text = "1 in "..chanceLouca if chanceLouca > 1 and chance < 50 then--Common strokeColor(Color3.fromRGB(17, 23, 80)) nameText.Variety.Title.Text = "Common" nameText.Variety.Title.TextColor3 = Color3.fromRGB(0, 174, 255) elseif chanceLouca > 50 and chanceLouca < 150 then--Uncommon strokeColor(Color3.fromRGB(23, 44, 0)) nameText.Variety.Title.Text = "Uncommon" nameText.Variety.Title.TextColor3 = Color3.fromRGB(18, 255, 1) elseif chanceLouca > 150 and chanceLouca < 400 then--Rare strokeColor(Color3.fromRGB(0, 0, 0)) nameText.Variety.Title.Text = "Rare" nameText.Variety.Title.TextColor3 = Color3.fromRGB(255, 0, 0) elseif chanceLouca > 400 and chanceLouca < 2000 then--Epic strokeColor(Color3.fromRGB(30, 0, 255)) nameText.Variety.Title.Text = "Epic" nameText.Variety.Title.TextColor3 = Color3.fromRGB(183, 0, 255) elseif chanceLouca > 2000 and chanceLouca < 8000 then--Legendary strokeColor(Color3.fromRGB(255, 119, 0)) nameText.Variety.Title.Text = "Legendary" nameText.Variety.Title.TextColor3 = Color3.fromRGB(251, 255, 0) elseif chanceLouca > 8000 then--Cosmic strokeColor(Color3.fromRGB(0, 0, 0)) nameText.Variety.Title.Text = "Cosmic" nameText.Variety.Title.TextColor3 = Color3.fromRGB(255, 255, 255) for i,v in pairs(nameText.Variety:GetChildren()) do local cosmic = script.CosmicGradient:Clone() cosmic.Parent = v end end end end end print(variant1,variant2) nameThingAndPaint(npc,npc.Name,variant1,variant2) print("Do") npc:MoveTo(position) npc.Parent = workspace.Enemies npc:MoveTo(position) if chance then npc:SetAttribute("Rarity",math.floor(chance+0.5)) end print("que") task.spawn(function() local humanoid = npc:WaitForChild("Humanoid") if not humanoid then return end humanoid.Died:Connect(function() local value = npc:FindFirstChild("MostDamage") for i,v in pairs(value:GetChildren()) do print(" player") local name = v.Name local plr = game.Players:FindFirstChild(name) if plr == nil then return end local backpack = plr:FindFirstChild("Backpack") if not backpack then return end print(" backpack") local variant1 = npc:GetAttribute("Variant1") local variant2 = npc:GetAttribute("Variant2") local miniature = require(game.ServerStorage.Modules.Misccc).giveMiniature(plr, variant1, variant2, npc:GetAttribute("Type")) if miniature == nil then warn("no miniature") return end local handle = miniature:FindFirstChild("Handle") if handle == nil then warn("no miniature handle") return end local model = handle:FindFirstChildOfClass("Model") if model == nil then warn("no miniature model") return end print("MINIATURE NOW") print(model, model.Name, variant1, variant2) local rarity = npc:GetAttribute("Rarity") if rarity and rarity > 8000 then warn("?") MessagingService:PublishAsync("RarityKill", {DisplayName=plr.DisplayName,Creature=npc.Name,Rarity=rarity}) end nameThingAndPaint(model,model.Name,variant1,variant2) end if npc:GetAttribute("Boss") == nil then local parts = npc:GetChildren() for i = 1, #parts do if parts[i]:IsA("BasePart") then game.TweenService:Create(parts[i],TweenInfo.new(1),{Transparency = 1,Size = Vector3.new(0,0,0)}):Play() end game.Debris:AddItem(parts[i],2) end game.Debris:AddItem(npc,1) end end) require(brain).Start() end) end) return npc end return module Assistant
Looking at your code, I can see the issue. When you create the miniature for the StarterGear, you're calling
enemies.Varia()on it, but you're not calling thenameThingAndPaint()function that actually updates the name to include the variant prefixes.The problem is in the
giveMiniaturefunction. After applying variants to both the backpack and StarterGear miniatures, you need to also update their names. However, thenameThingAndPaintfunction is defined inside theSummonfunction, making it inaccessible.Here's the fix - move the
nameThingAndPaintfunction outside ofSummonand call it for both miniatures:-- Add this function at the module level (outside of Summon) local function nameThingAndPaint(npc, name, variant1, variant2, chance) if npc.Parent ~= nil and npc.Parent.Name == "Handle" then npc.Parent.Parent:SetAttribute("Variant1",variant1) npc.Parent.Parent:SetAttribute("Variant2",variant2) if chance then npc.Parent.Parent:SetAttribute("Rarity",chance) end end if variant1 == nil then variant1 = "" end if variant2 == nil then variant2 = "" end variant1 = variant1:sub(1,1):upper() .. variant1:sub(2) or "" variant2 = variant2:sub(1,1):upper() .. variant2:sub(2) or "" local name = npc.Name name = variant1.." "..variant2.." "..name name = name:gsub("%s+", " "):gsub("^%s+", ""):gsub("%s+$", "") --removes double spaces npc.Name = name if npc.Parent ~= nil and npc.Parent.Name == "Handle" then npc.Parent.Parent.Name = name end -- Rest of the function remains the same... end module.giveMiniature = function(plr, variant1, variant2, name) print(name) local miniature = Miniatures:FindFirstChild(name) if miniature == nil then return end miniature = miniature:Clone() local handle = miniature:FindFirstChild("Handle") if not handle then return end local model = handle:FindFirstChildOfClass("Model") if not model then return end miniature.Parent = plr:FindFirstChild("Backpack") enemies.Varia(model, name, variant1, variant2, "miniatura") -- Add this line to update the name for the backpack miniature nameThingAndPaint(model, name, variant1, variant2, nil) local miniature2 = miniature:Clone() miniature2.Parent = plr.StarterGear local handle2 = miniature2:FindFirstChild("Handle") if not handle2 then return end local model2 = handle2:FindFirstChildOfClass("Model") if not model2 then return end enemies.Varia(model2, name, variant1, variant2, "miniatura") -- Add this line to update the name for the StarterGear miniature nameThingAndPaint(model2, name, variant1, variant2, nil) return miniature endThen in your
Summonfunction, replace the localnameThingAndPaintdefinition with a call to the module-level function.This way, both the backpack and StarterGear miniatures will have their names properly updated to include the variant prefixes like "Winged Zombie" instead of just "Zombie".
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.