|
| 19 Jul 2014 04:24 AM |
Ok so I have this game thats a WIP and when i got some of the intro done i realized when the loading starts the guis lag like crazy and i know it is because of a server script i put that inserts surfacegui's all over every white brick in the game (all bricks in white are outlines of the arena) and cycles the color. Additionally it puts studs on every brick in the game to reduce sliding. I really don't have alot of ideas I could reduce the lag I've only tried one which is numeric for loops and it only seemed to reduce it by a little
heres the place it is open ATM because of this issue http://www.roblox.com/Ultimate-Neon-Dodgeball-place?id=167135323
heres the script that does the cycling
local Objects = {}
function GetAll(o) for _,v in pairs(o:GetChildren()) do if v:IsA("BasePart") then v.Friction = 1 v.TopSurface = "Studs" v.BottomSurface = "Studs" v.RightSurface = "Studs" v.LeftSurface = "Studs" v.FrontSurface = "Studs" v.BottomSurface = "Studs" end if v:IsA("BasePart") and v.BrickColor == BrickColor.new("Institutional white") then for _,w in pairs(script:GetChildren()) do local clone = w:Clone() clone.Parent = v table.insert(Objects,clone.Frame) end local shad = Instance.new("PointLight",v) shad.Shadows = true shad.Color = Color3.new(0,0,0) shad.Brightness = 20 shad.Range = 20 end GetAll(v) end end GetAll(script.Parent)
game.Workspace:WaitForChild("GlowStatus").Changed:connect(function() local GlobalGlow = game.Workspace:WaitForChild("GlowStatus") for i = 1,#Objects do Objects[i].BackgroundColor3 = Color3.new(255/65025 * GlobalGlow.R.Value,255/65025 * GlobalGlow.G.Value,255/65025 * GlobalGlow.B.Value) Objects[i].BorderColor3 = Objects[i].BackgroundColor3 end end)
coroutine.resume(coroutine.create(function() local gs = game.Workspace:findFirstChild("GlowStatus",true).R local start = math.random(1,255) local dir = true local num = 150 if start > 254/2 then dir = true else dir = false end while wait() do if dir then while num <= 255 do gs.Value = num num = num + 1 gs.Parent.Value = gs.Parent.Value + 1 wait() end dir = false else while num >= 0 do gs.Value = num gs.Parent.Value = gs.Parent.Value + 1 num = num - 1 wait() end dir = true end end end))
coroutine.resume(coroutine.create(function() local gs = game.Workspace:findFirstChild("GlowStatus",true).G local start = math.random(1,255) local dir = true local num = 150 if start > 254/2 then dir = true else dir = false end while wait() do if dir then while num <= 255 do gs.Value = num num = num + 1 wait(.1) end dir = false else while num >= 0 do gs.Value = num num = num - 1 wait(.1) end dir = true end end end))
coroutine.resume(coroutine.create(function() local gs = game.Workspace:findFirstChild("GlowStatus",true).B local start = math.random(1,255) local dir = true local num = 150 if start > 254/2 then dir = true else dir = false end while wait() do if dir then while num <= 255 do gs.Value = num num = num + 1 wait(.2) end dir = false else while num >= 0 do gs.Value = num num = num - 1 wait(.2) end dir = true end end end))
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 19 Jul 2014 06:50 AM |
SurfaceGuis?
Laggy.
Coroutines?
Laggy.
Loops?
Laggy, but sometimes cannot be avoided. |
|
|
| Report Abuse |
|
|
| |
|
Stewie140
|
  |
| Joined: 24 Dec 2010 |
| Total Posts: 212 |
|
|
| 19 Jul 2014 07:17 AM |
JEEZ that is a long script! Ummm, first of all congrats on your scripting skills. It's probably when you go into studio, save, then publish the network server makes it lag because of the computer built it. I've had this issue in the past, had to renovate my whole entire place just because it was so annoying! Cheers.
Stewie140 |
|
|
| Report Abuse |
|
|
| |
|