how would I make the fog change not once player is in water, but reather make the camera detect if player is or isnt in water?
What do you mean, I don’t understand what you want to do
so these lines, which arent in your script btw local CameraUnderwater = false for _, water in pairs (waterParts) do local CameraV3 = water.CFrame:PointToObjectSpace(camera.CFrame.Position) CameraUnderwater = (math.abs(CameraV3.X) <= water.Size.X / 2) and (math.abs(CameraV3.Y) <= water.Size.Y / 2) and (math.abs(CameraV3.Z) <= water.Size.Z / 2) if CameraUnderwater then break end end game.Lighting.FogColor = Color3.new(0, 0.027451, 0.545098) game.Lighting.FogStart = 0 game.Lighting.FogEnd = 50
detects if the CurrentCamera is inside the water. So the underwater effects appear not when the player touches the water. They appear when the camera enters the water. Like in terrain water. I would like to the script to also know when the camera is not inside the water, so the underwater effects can go away.
I would like to use fog over atmoshphere because it is less performance heavy
This is amazing! I will definitely use this for my game!
To change to fog you should modify the underwater lighting module:
Those 2 parts are what you should change. The functions are called automatically when the camera enters the water.
I did. Look at my post up there
Try removing the sky object, can’t debug it myself right now
Does this work with parts generated via script and not in game at runtime?
It does as long as you tag them correctly or put them into the containter. The script checks for new added instances.
Yeah I found it out but I think you actually had an issue in your code.
I added in the container =
line, you were calling it everytime it updated but not actually resetting it,
This is absolutely helpful. I haven’t actually thought anyone would make this as it is very advanced, and it helps because it reduces all of that lag that you could get if you were to use terrain water rather than one single part.
How can I make it so you don’t float but instead just swim in one place when you are not moving?
Does anyone know how to get around the infinite jump bug?
Is this what you mean? It’s quite self-explainatory.
What infinite jump bug? I’m not aware of any problems
Its a bug where the player can hold space and jump forever essentially. (at the top of water)
Seems like a very nice module. I modified it to use CollectionService exclusivly and made it so tags can be added during runtime (and not have a single tag beforehand). However, I noticed one little error with the module
Where there is the code for detecting when a tag is added or removed, it listens to the “water_parts” tag instead of using the tag variable. This means that for people who use collection service and a custom tag, if a tag is added to a part during runtime, the script will not detect it
Thanks for pointing that out. It is fixed now.
Important update: The system now works with gamepad. It should have worked before but since I couldn’t test it I wasn’t able to know.