holder = Instance.new("Model") holder.Parent = game.Workspace holder.Name = "Holder"
foodamount = Instance.new("IntValue") foodamount.Name = "FoodAmount"
serverstorage = game:GetService("ServerStorage")
game.Players.PlayerAdded:connect(function(plr) --FoodAmount Value
foodamount.Parent = game.Players[plr.Name]
end)
totalvalue = game.Workspace.Scripts.TotalFood
while totalvalue.Value <= 2000 do --while totalvalue.Value <= 2000 do
food = Instance.new("Part")
food.BrickColor = BrickColor.Random()
food.Size = Vector3.new(1, 1, 1)
food.Position = Vector3.new(math.random(-499.3, 499.3), -7, math.random(-499.3, 499.3))
food.Parent = holder
food.Name = "Food"
food.CanCollide = false
food.Anchored = true
food.BackSurface = "SmoothNoOutlines"
food.BottomSurface = "SmoothNoOutlines"
food.FrontSurface = "SmoothNoOutlines"
food.LeftSurface = "SmoothNoOutlines"
food.RightSurface = "SmoothNoOutlines"
food.TopSurface = "SmoothNoOutlines"
totalvalue.Value = totalvalue.Value + 1
wait()
if totalvalue.Value >= 700 then --if totalvalue.Value >= 2000 then
break
end
end
Once the totalvalue.Value >= 700, the while true do loop breaks, then when the value is less than 700, it won't reloop and spawn more parts? Help? thanks
