generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Lag

Previous Thread :: Next Thread 
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
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
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
19 Jul 2014 04:48 AM
Bump
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
19 Jul 2014 06:33 AM
"Bump"adeedledoo


-Was Here
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jul 2014 06:50 AM
SurfaceGuis?

Laggy.

Coroutines?

Laggy.

Loops?

Laggy, but sometimes cannot be avoided.
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
19 Jul 2014 07:16 AM
:C


-Was Here
Report Abuse
Stewie140 is not online. 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
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
19 Jul 2014 07:58 AM
thanks but huh?


-Was Here
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image