Hi, how can I know when the player stops swimming?
Is there’s a humanoid state type for that?
Hi, how can I know when the player stops swimming?
Is there’s a humanoid state type for that?
Here,
if Humanoid:GetState() == Enum.HumanoidStateType.Swimming then
end
Im not sure exactly how this will turn out. Also when you mean stop swimming, are you talking about getting on land? If its in water, You can find if the player is moving
I’m talking about getting on land, i tried with the state “Landed”, but it change some values that i have for the player.
Example:
I have these values for the player.

When the player is swimming, the values turn to false.
But if I use the state “landed,” the values always change to the default values, disturbing some functions.
What do you mean by default values
The values inside this table:

But wait, i have an idea.
The landed state only fires when you hit the ground from falling. I don’t think you want to use it for ‘stopped swimming’
The best way is as @X0BaconHairDude0X said, check the swimming state, or
you can check for the event.
Humanoid.Swimming:Connect …
and
Humanoid.Running:Connect …
Running fires whenever the humanoid is standing or moving on land.
So, i did this and it worked:
Humanoid.StateChanged:Connect(function(Swimming)
if Swimming == Enum.HumanoidStateType.Swimming then
Values.IsSwimming = true
else
Values.IsSwimming = false
end
end)
I think there’s a better way, but this was a fast solution i found.
Im glad it worked, a better way may be harder to find but at least you have an solution
You got me the idea with the code you send, Tysm.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.