Did you add 1 to Value after every time it spawns a tree?
NABSED
(ItsM3Cap)
#3
Yes i did i made a script for it
May we see the full code that you have? It’s likely an issue with the Value
variable or something else is wrong
NABSED
(ItsM3Cap)
#5
"lua
local Folder = script.Parent.Parent.Trees
local Count = script.Parent.TreeAmount.Value
Folder.ChildAdded:Connect(function()
Count = Count + 1
print(Count)
end)
Folder.ChildRemoved:Connect(function()
Count = Count - 1
print(Count)
end)
"
while Value < 10 do
-- Stuff
if Value >= 10 then
break -- this stops the loop
end
end
I’ll assume that Value
is the value of TreeAmount
, the way you’re doing it only changes the Count
variable, it doesn’t change the value of TreeAmount
.
Change local Count = script.Parent.TreeAmount.Value
to local Count = script.Parent.TreeAmount
And everytime you reference Count
, you change it to Count.Value
, Count.Value += 1
and Count.Value -= 1
If Value
is referecing something else we need to see the While loop code
Also if Value
has the same issue as Count
, you’d need to fix that as well
1 Like
Crygen54
(Crygen)
#8
When childs are removed, you can use “repeat until” repeat up the count value and respawn your things until count value is at 10 for example
1 Like
NABSED
(ItsM3Cap)
#9
It does not seem to work for me.
NABSED
(ItsM3Cap)
#10
oops i forgot to make it a reply of your last message
NABSED
(ItsM3Cap)
#11
I made it repeat Instead of while and it still doesn’t stop
NABSED
(ItsM3Cap)
#12
Ive did it. I just made it repeat then placed the counter inside it
NABSED
(ItsM3Cap)
#13