DAPSUEL
(DAPSUEL)
February 2, 2024, 9:49pm
#1
so this script already prevents npc’s spawning if there’s any in workspace, but I want for it to spawn more if there’s 5 or less in workspace
local existingMinions = workspace:FindFirstChild("BludMinions")
if existingMinions then
Head.Sad:Play()
else
1 Like
manounou0
(TheRobloxian)
February 2, 2024, 9:54pm
#2
is it a local or a normal script ?
DAPSUEL
(DAPSUEL)
February 2, 2024, 10:00pm
#3
it’s a normal script. Located in ServerScriptService
manounou0
(TheRobloxian)
February 2, 2024, 10:13pm
#4
do a folder where every blud minions will go
DAPSUEL
(DAPSUEL)
February 2, 2024, 10:27pm
#5
yeah what goes after that???
manounou0
(TheRobloxian)
February 2, 2024, 10:29pm
#6
you need to do a in pairs thingy if you dont know what it is go ask to google me im not pretty good at scripting and i forgot what to do lol
I think you can do
local existingMinions = workspace:FindFirstChild("BludMinions"):GetChildren()
if #existingMinions < 5 then--if number of minions is folder is less than five, then
Head.Sad:Play()
else
This won’t work if you have something besides minions in the folder, you need npc’s ONLY in the folder, nothing else.
DAPSUEL
(DAPSUEL)
February 2, 2024, 11:40pm
#8
attempt to index nil with ‘GetChildren’
Lametta
(Lametta)
February 3, 2024, 12:18am
#9
He thought that BludMinions was a folder for the minions *because it should be.
Though to fix what he assumed
local mins = 0
for _,v in pairs(workspace:GetChildren()) do
if v.Name == "BludMinions" then
mins += 1
end
end
if mins > 5 then
Head.Sad:Play()
end
1 Like
DAPSUEL
(DAPSUEL)
February 3, 2024, 12:31am
#10
after some fixes for it to work with my script, and adding a folder this worked!
1 Like
system
(system)
Closed
February 17, 2024, 12:32am
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.