-
I want to figure out why one particular NPC doesn’t spawn but the rest of them do.
-
What is the issue? I have just made a new NPC, head, torso,arms and legs, humanoid, humanoidriotpart etc. Apart from one of my other npcs being a car, I cannot for the life of me figure out why this particular NPC doesn’t spawn using a script that I’ve been using without a problem for months while I’ve been developing this game. Has anyone had this issue before? I don’t really want to chuck it in the bin so thought I’d ask on here if anyone has experienced the same thing and what did you do to fix this?
Could you show the script? Cant really do anything with that info
If your npcs have specific data folders that your script checks for when spawning them, make sure they’re found under that npc. Otherwise, showing the script would help solve your problem.
Apologies for not putting the script in. I ddnt think it would be a problem with my script because my other towers work but ive just made another tower and that also doesnt spawn in. They are in my towers folder all in the right place with the right into values etc. I just cant understand it…
local function AddPlaceholderTower(name)
local towerExists = towers:FindFirstChild(name)
if towerExists then
RemovePlaceHolderTower()
towerToSpawn = towerExists:Clone()
towerToSpawn.Parent = workspace
CreateRangeCircle(towerToSpawn, true)
for i, object in ipairs(towerToSpawn:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Towers")
if object.Name ~= "Range" then
object.Material = Enum.Material.ForceField
object.Transparency = 0.3
end
end
end
gui.Controls.Visible = true
end
end
local function SpawnNewTower()
if canPlace then
local placedTower = spawnTowerFunction:InvokeServer(towerToSpawn.Name, towerToSpawn.PrimaryPart.CFrame)
if placedTower then
placedTowers += 1
RemovePlaceHolderTower()
toggleTowerInfo()
end
end
end
gui.Controls.Cancel.Activated:Connect(RemovePlaceHolderTower)
gui.Selection.Selections.Action.Upgrade.Activated:Connect(function()
if selectedTower then
local upgradeTower = selectedTower.Config.Upgrade.Value
local upgradeSuccess = spawnTowerFunction:InvokeServer(upgradeTower.Name, selectedTower.PrimaryPart.CFrame, selectedTower)
if upgradeSuccess then
selectedTower = upgradeSuccess
toggleTowerInfo()
end
end
end)