|
| 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
|
  |
| Joined: 24 Sep 2011 |
| Total Posts: 8152 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 26 Jul 2014 09:14 PM |
forumPost.Landish:Destroy()
:D
-Was Here |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 09:15 PM |
sweg(:Destroy():Destroy())
destroyed the destroy of sweg yey :D |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2014 09:16 PM |
seriously i need a solid comment ._.
-Was Here |
|
|
| Report Abuse |
|
|