Upon learning that the .Swimming event would not trigger while the Humanoid was in the PlatformStand state, I immediately began to seek a way around this. So, I came to the idea that the GetCell function would help, but it did not. I needed a way to determine whether the player was in water or not.
local PX,PY,PZ=Character.Torso.Position.x,Character.Torso.Position.y,Character.Torso.Position.z local CM,CB,CO=game.Workspace.Terrain:GetCell(PX,PY,PZ) print(PX,PY,PZ) print(CM) if CM == Enum.CellMaterial.Empty then print("EmptySpace") end
Please note the above script was ran every frame, using a LocalScript. This was the constant output taken from the GetCell function.
Enum.CellMaterial.Empty Enum.CellBlock.Solid Enum.CellOrientation.NegZ
--Edit, I used GetWaterCell after finding it on the wiki and changed my script to fit the new function. vvvvvvvv
local PX,PY,PZ=Character.Torso.Position.x,Character.Torso.Position.y,Character.Torso.Position.z local hasWater,waterForce,waterDirection=game.Workspace.Terrain:GetWaterCell(PX,PY,PZ) print(hasWater,waterForce,waterDirection) if hasWater then print("EmptySpace") end
Output:
false Enum.WaterForce.None Enum.WaterDirection.NegX