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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 27 Jul 2016 |
| Total Posts: 1205 |
|
| |
|
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 |
|
|