Water diving problem

Hello. So my friend and I are making a game, and there is a lake that is not quite good-looking under it surface. I played games and noticed that players cannot dive in the water, so I searched the internet, but found nothing.

How do I make players not able to dive in the water?

Hey, there are multiple ways you could stop a player from diving into the water. You can prevent players from diving into the water by using a combination of parts and scripting.

You can create a part that covers the surface of the lake, making sure to set its “CanCollide” property to “false” so that players can’t stand on it. You can then make this part invisible so that the lake surface appears unchanged.

Additionally, you can create another part that lies below the surface of the lake. This part can have its “CanCollide” property set to “true” to prevent players from diving into the water. You can make it larger than the lake and position it in such a way that players will be stopped from diving.

You can also use scripting to prevent players from diving. For example, you can create a script that checks the player’s position and if it falls below the surface of the lake, it will be teleported back to the surface. You can also adjust the player’s velocity to prevent them from diving.

Here is an example script that prevents players from diving into the water:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local waterLine = 20 -- The height of the water line

	if prop == "PlatformStand" and char.HumanoidRootPart.Position.Y < waterLine then
		char.HumanoidRootPart.CFrame = CFrame.new(char.HumanoidRootPart.Position.X, waterLine, char.HumanoidRootPart.Position.Z)
		char.Humanoid.PlatformStand = false

This script sets the water line at 20 units above the ground, and then constantly checks the player’s position. If the player falls below the water line, it teleports the player back to the water line.

Thanks for help m8


Ofcourse! I’d appreciate it if you mark my post as the solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.