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 » Scripters
Home Search
 

Re: VERY laggy script

Previous Thread :: Next Thread 
storm_xst is not online. storm_xst
Joined: 27 Jul 2016
Total Posts: 1205
28 Aug 2016 11:36 AM
local w = game.Workspace
local Mountains = w.AreaMountains
local Turbo = w.AreaLavaGorge
local musicfolder = script.Parent.Music


function MountArea()
if musicfolder.SnowyMountain.Playing == true then return end
musicfolder.SnowyMountain:Play()
game.Lighting.FogEnd = 500
game.Lighting.FogColor = Color3.new (212, 212, 212)
end

function MountExit()
if musicfolder.SnowyMountain.Playing == false then return end
musicfolder.SnowyMountain:Stop()
game.Lighting.FogEnd = 10000
end

function TurboArea()
if musicfolder.TurboTunnel.Playing == true then return end
musicfolder.TurboTunnel:Play()
game.Lighting.FogColor = Color3.new (202, 45, 18)
game.Lighting.FogEnd = 500
end

function TurboExit()
if musicfolder.TurboTunnel.Playing == false then return end
musicfolder.TurboTunnel:Stop()
game.Lighting.FogEnd = 10000
end


Mountains.Touched:connect(MountArea)
Mountains.TouchEnded:connect(MountExit)
Turbo.Touched:connect(TurboArea)
Turbo.TouchEnded:connect(TurboExit)

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

Okay, so first off, if I'm in either of these areas the game will lag hard. I thought the if statement would stop this but it doesn't.
The other issue is that the FogColor is not actually coloured correctly. It causes a bright white screen and each value is way over 10000. I don't know why, did I change the colour incorrectly?
Report Abuse
Cole3bob4 is not online. Cole3bob4
Joined: 08 Jan 2011
Total Posts: 4475
28 Aug 2016 11:39 AM
If it's laggy when the fog comes in it's probably your computer


Report Abuse
batistapowerbonbtla is not online. batistapowerbonbtla
Joined: 16 Dec 2011
Total Posts: 2203
28 Aug 2016 11:40 AM
Color3.new() arguments must be between 0 and 1, so you need to divide the numbers by 255
Or you can use Color3.fromRGB(255, 0, 0)
Report Abuse
storm_xst is not online. storm_xst
Joined: 27 Jul 2016
Total Posts: 1205
28 Aug 2016 12:07 PM
"If it's laggy when the fog comes in it's probably your computer"

This happens regardless of the fog, and my computer can run DOOM@1080p60fps. So I don't think that's the issue. Maybe I should put in an extra debounce though, I suppose it could be CPU strain

Oh, and thank you, batista!

Report Abuse
storm_xst is not online. storm_xst
Joined: 27 Jul 2016
Total Posts: 1205
28 Aug 2016 03:29 PM
I have isolated the problem, at least. The lag does not happen if the script is disabled. If I enable it in-game the lag starts immediately (providing I'm in one of the two areas)

Even if the fog is not changed it still lags. So it must be how the script handles itself.

How can I reduce lag? I've tried something like:

function TurboArea()
if turbodebounce == true then return end
if musicfolder.TurboTunnel.Playing == true then return end
turbodebounce = true
musicfolder.TurboTunnel:Play()
game.Lighting.FogColor = Color3.fromRGB(202, 45, 18)
game.Lighting.FogEnd = 500
wait(5)
turbodebounce = false
end


-------


but that doesn't reduce that lag. And it's not a minor thing, the framerate PLUMMETS
Report Abuse
storm_xst is not online. storm_xst
Joined: 27 Jul 2016
Total Posts: 1205
28 Aug 2016 05:31 PM
a
Report Abuse
storm_xst is not online. storm_xst
Joined: 27 Jul 2016
Total Posts: 1205
30 Aug 2016 04:35 PM
Still have no clue why this is happening. No significant CPU usage. Definitely not GPU.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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