How to detect swimidle, and player is on the surface of water, or getting near the surface?

Hello,

I have scripts running that detect if the player is swimming, swim speed, and such, but for effects, I want to know if they are on the surface, in the swimidle, not going up (meaning treading water on the surface. )

I have an effect that goes on during swimming, but I need to turn it off as the player gets near the top of the water, either when they are floating up in swimidle, or swimming up near the surface. So the effect is not going on when they are near the surface, and also does not go on when they are in swimidle at the top of the surface.

Looking for ideas from you all, without doing region checking because there is lots of water in terrain all over the place…

I have not found anything script wise to detect if the player is swimidle (I know you can change the animation, and maybe kick a script during it to do checks perhaps) or if they are on the surface, (because they are still in the swimming state) or if they are like swimming on the surface, I would like the effect off.

Any ideas would be fantastic!
Thanks

Not sure what you mean by “Region checking” but could you use Terrain | Documentation - Roblox Creator Hub to get like a four-voxel high column centered on the player and infer where they are based on which ones are water?

ahh, ok ok , I’ll look into that.
Do you know of any links I can check out that relates to Terrain:ReadVoxels, that that has more then one column? because when swimming they could be in any direction, so my guess is you would need a couple of them in different directions of the player. And if one of them says, hey buddy, ur not in water, turn off effect… even tho the player is in water, it would be doing what I am looking for.

Thanks for the reply too! Nicemike40 Rocks!