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
26 Jul 2014 08:37 PM
so im working on a game and in the arena is a script that outlines it surfacgui's and the gui's cycle through colors but it pretty much makes everything else that is server side lag and i know this because when i disabled it everything running was totally smooth

ive tried

a. using numeric iterations
b. changing the rate it changes ( now every 5 seconds )

its noticibly reduced the lag but the lag is still present and im asking for suggestions to further reduce it

here is the code

-----------------------------

function GetAll(o)
for _,v in pairs(o:GetChildren()) do
if v:IsA("BasePart") then
v.Friction = 1
v.Material = "SmoothPlastic"
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
game.Workspace:WaitForChild("GlowStatus").Changed:connect(function()
pcall(function()
local GlobalGlow = game.Workspace:WaitForChild("GlowStatus")
clone.Frame.BackgroundColor3 = Color3.new(255/65025 * GlobalGlow.R.Value,255/65025 * GlobalGlow.G.Value,255/65025 * GlobalGlow.B.Value)
clone.Frame.BorderColor3 = clone.Frame.BackgroundColor3
end)
end)
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)

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

wait()
end
dir = false
else
while num >= 0 do
gs.Value = num
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))

while true do
game.Workspace.GlowStatus.Value = game.Workspace.GlowStatus.Value + 1
wait(5)
end


-Was Here
Report Abuse
Landish is not online. Landish
Joined: 24 Sep 2011
Total Posts: 8152
26 Jul 2014 09:07 PM
put it in a local script
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
26 Jul 2014 09:10 PM
local scripts dont work in workspace or do u mean like share the cycling between players?


-Was Here
Report Abuse
Landish is not online. Landish
Joined: 24 Sep 2011
Total Posts: 8152
26 Jul 2014 09:11 PM
add this line to fix it:

script.Parent:Destroy()

-- :D
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
26 Jul 2014 09:14 PM
forumPost.Landish:Destroy()

:D


-Was Here
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
26 Jul 2014 09:15 PM
sweg(:Destroy():Destroy())

destroyed the destroy of sweg yey :D
Report Abuse
TochiWasHere is not online. TochiWasHere
Joined: 13 Mar 2013
Total Posts: 160
26 Jul 2014 09:16 PM
seriously i need a solid comment ._.


-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