local bp = game.Workspace.Baseplate local parts = game.Workspace.Parts.Parts --numbervalue local x = bp.Position.X local xS = bp.Size.X / 2 local y = bp.Position.Y + (bp.Size.Y / 2) local z = bp.Position.Z local zS = bp.Size.Z / 2 local eat = game.Workspace.Parts:GetChildren() limit = 30 balance = 10 while true do if parts.Value <= limit then print("spawning") for i=1,limit do touch = script.Touch:Clone() local newpart = Instance.new("Part",game.Workspace.Parts) newpart.Name = "Eat" newpart.Size = Vector3.new(0.6,0.6,0.6) newpart.Color = Color3.new(math.random(),math.random(),math.random()) newpart.Anchored = true newpart.FrontSurface = "SmoothNoOutlines" newpart.BackSurface = "SmoothNoOutlines" newpart.BottomSurface = "SmoothNoOutlines" newpart.LeftSurface = "SmoothNoOutlines" newpart.RightSurface = "SmoothNoOutlines" newpart.TopSurface = "SmoothNoOutlines" touch.Parent = newpart touch.Disabled = false local pos = Vector3.new(math.random(math.min(x - xS), math.max(xS + x)), y, math.random(math.min(z - zS), math.max(zS + z))) print(pos) newpart.CFrame = newpart.CFrame - newpart.Position + pos newpart.Position = newpart.Position + Vector3.new(0,1.85,0) parts.Value = parts.Value + 1 wait(2) end if parts.Value == limit then print("limit") wait(balance) end end end
My script basically creates a bunch of parts in range of the baseplate. The problem is that the script stops running in between the second loop. The error is "Game script timeout" and I don't know what that means.
You should always put a wait() in any loop you create. (while true do, for i=1, for i,v in pairs etc.)
That might be the issue!