High performance water: Swimmable part 2.0

For some reason my character glitches out when trying to leave the water.
https://gyazo.com/cdfabda61484982bdcfd3cff543f58e7

I didn’t change the module and used it as it came, nor am I changing the humanoid state anywhere else.

1 Like

Could you recreate the bug on a baseplate and send it to me? I have no idea what could be causing the issue

1 Like

I found the issue, if your jump power is set to 0 it’ll cause this issue. I have a jump debounce system so people can’t bunnyhop, it seems to have interfered with it, fixed it on my side now. Thanks for the response nonetheless, great module!

3 Likes

I came here in order to see if this swimming system has the same issue as mine and it does, when disabling the Jumping HumanoidState the Jump button on mobiles disappears, making mobile players get stuck in the water. (They cannot jump out)

The only workaround I found was to clone the Jump button and simulate that it’s the same button.

1 Like

Yeah, already talked about that in the main post

1 Like

Oops sorry for the inconvenience then, I didn’t fully read, was skimming through it trying to find that. I thought I would find it in the About the system.

1 Like

is this possible with collectionservice?

1 Like

Just added that and published a new version

1 Like

Hi again! Remember I mentioned 2 problems I found in this water system? Good news, I spoke to a developer who gave me a suggestion. Reminder, the 1st issue was, that mobile had no jumpbutton in water and the 2nd problem was that if CharDensity is above 5 and u press space, the player shoots out of the water. Here is what the developer texted me: you have to do some math and add velocity to the root part when jumping. make sure it isnt too high so set a target for what it is supposed to be and make sure it hits the target and doesnt exceed it. connect to the controlmodule to check if the player is on a phone and holding the jump button

1 Like

Sorry, forgot about this issue.

I just tested the system and finally figured out how to get launched into the air. However, I don’t understand what that developer says, so I’ll find my own way around.
And about the jump button, the player can’t hold it because it doesn’t exist, so I don’t know how he thinks the player is supposed to hold the button.

Hey man thanks, this works great :)))

1 Like

Hello everyone! and I have a question, how can i make the player not dive in to the water, like make it moves only in the x and z coordinates and have both swimidle and swimming animation?, the tutorials i found only have a idle animation. =(

1 Like

I changed the Atmosphere is Underwater_Lighting to FogColor, FogStart, FogEnd because atmosphere can cause lag on older devices.


that’s how my testing game looks before I enter the water

thats what it looks like in the water

but when I come out of the water my testing game looks like I am still in the water

I only changed the Underwater_Lighting script by removing atmosphere and changing the script to this :

local module = {}

local lighting = game:GetService("Lighting")

local sky = script:WaitForChild("Sky")

local previousObjects = {}

local enbled = false

function module:Add()
	if enabled then return end
	enabled = true
	
	for _, v in lighting:GetChildren() do
		v.Parent = script
		table.insert(previousObjects, v)
	end
	
	game.Lighting.FogColor = Color3.new(0, 0.027451, 0.545098)
	game.Lighting.FogStart = 0
	game.Lighting.FogEnd = 50
	sky.Parent = lighting
end

function module:Remove()
	if not enabled then return end
	enabled = false
	
	for _, v in script:GetChildren() do
		v.Parent = lighting
	end
	
	game.Lighting.FogColor = Color3.new(0, 0.027451, 0.545098)
	game.Lighting.FogStart = 0
	game.Lighting.FogEnd = 50
	sky.Parent = script
	
end

return module
1 Like

This is great, and I’ll be using it in my game.

I think it would be nice if the colour of the atmosphere reflected the colour of the part that the player is swimming in. That way, for example, if the water is green, then the atmosphere would also be green.

Additional functionality could be an option to set a “sea level” (a number on the y axis), and make it so the player starts swimming if they’re ever below this number (sea level). This could be used for games with lots of water.

Thanks!

1 Like

idk why it bugs like this (i am using a normal part not any mesh

What’s the depth of the water?

it goes up to the shoulders on the video
this rarely happens in r15 too

1 Like

@gpm231 my question isnt answered still :confused:

what question do you mean about that???

You use same function part for both module:Remove and module:Add

game.Lighting.FogColor = Color3.new(0, 0.027451, 0.545098)
game.Lighting.FogStart = 0
game.Lighting.FogEnd = 50