#fast question about a loop.
1 messages · Page 1 of 1 (latest)
if barry then is true all the time except if the value is false
show the whole code next time plz
ill show it now
** You are now Level 9! **
y tho i just told you, if barry then is only checking the truthiness of the value. it doesnt matter if its an instance named barry or not.
you right but it seems that thats not he problem
wait a sec ill send the script
local bushpart = game.Workspace:WaitForChild("BushPart")
local barriesfolder = bushpart:WaitForChild("Barries")
function foundbarries()
local barriestables = {}
for _, barry in pairs(barriesfolder:GetChildren()) do
if barry then
table.insert(barriestables, barry)
print("barry found")
barry.Size = Vector3.new(0,0,0)
end
end
return barriestables
end
local barrytable = foundbarries()
print(#barrytable)
for _, barry in pairs(barrytable) do
if barry then
print("barry found",_)
local growth = barry:FindFirstChildWhichIsA("BoolValue")
local prompt = barry:FindFirstChildWhichIsA("ProximityPrompt")
for i = 0, 3 do
barry.Size = barry.Size + Vector3.new(0.1,0.1,0.1)
task.wait(3)
print("barry size updated")
end
growth.Value = true
prompt.Enabled = true
end
end
@junior flame
local script or serverscript?
whats wrong with it
im doing something wrong with the 2nd loop
basically
for i = 0, 3 do
barry.Size = barry.Size + Vector3.new(0.1,0.1,0.1)
task.wait(3)
print("barry size updated")
end
growth.Value = true
prompt.Enabled = true
this works only for one berry
maybe there's only one
your code only runs once so there's that
use collectionservice maybe
also ☠️ grow a garden clone
if you stuck on this you aint no chance at the offline thing 
bro wtf im just trying to learn scripting and making a collectable berry not grow a garden
btw
what do you mean by using collectionservice
why would i need that
maybe look up what it is and you tell me some situations where you might need that 
i know what is it
but i dont find reason to use it there
broo im so confused this should be easy
what is wrong with that loop
every berry should grow
serverscript
yea
maybe
some debug lines?
to see
but as i said print("barry found",_)
it prints barry found 1
so yea like i was saying your code only runs once so if you have a different script creating them it might only be picking up one. do also add more prints, check output window, consider breakpoints etc
check your explorer to see if there's more than 1 in the right place etc
the weird thing is that if i check the table before the loop it gives all the 5 berries, but inside the loop i get only one
tell me some situations where you might need collectionservice which is not at all related to a collection of berries on a berry bush and even less related to the first step in making a grow a garden clone etc but idk i just say things for the sake of saying things sometimes, your guess is as good as mine 
you also have a task.wait in the big loop so whole thing runs very sloooow lua for i = 0, 3 do barry.Size = barry.Size + Vector3.new(0.1,0.1,0.1) task.wait(3) print("barry size updated") end
it needs to be like that
every 3 seconds it grows
which i'm sure has nothing to do with an attempted first berry bush of a grow a garden clone idk im just saying stuff for the sake of saying stuff at this point
is it wrong?
good luck 
i said that im not making grow a garden?
.
not every bush means is grow a garden, im learning scripting and i tought this was a good thing to start
why would i lie to you xd
i appreciate the suggestions but i dont understood why did u get mad over the fact that im cloning a game
even if i was doing that its still a great thing to "replicate systems" to learn
so it is a fact that you're trying to clone grow a garden as your first game? why would you lie to me indeed xd
also i dont care all that much i just think it's funny any time a new game hits the front page tonnes of attempted clones will immediately follow, for the last few weeks it's been dead rails, now it's grow a garden lol. it's bound to happen. anyway like i said maybe try collectionservice.
alr so tell me why would i clone a game? im just doing a bush grow system to exercise on functions and loops, there are thousands of tutorial on youtube of how to clone grow a garden i think so there is a reason if im not watching them im just trying to learn some fondumentals
i dont really care if u think im cloning a game or not, im just trying to make some systems to undestand the foundumentals, it can be a survival game too lol. btw just dont stress too much about it thanks for the suggestions
for weeks before dead rails it's been mostly tsb clones, it's nice to see beginners moving onto something arguably much easier to make than a combat system or making trains follow a path of rails or procedural generation etc
there's only been a couple of questions about procedurally generating plants ;p
collectionservice has a lot of properties that are very useful for what you're trying to do and conveniently solve a lot of little problems in what you're trying to do, and no doubt you're going to want more than 1 berry bush, so may as well rip that bandaid off and give it a shot 👍