Disabling the ability for a custom Character to swim

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Making you not be able to swim as a model controlled by a player.
  2. What is the issue? Include screenshots / videos if possible!
    Its floating even though I put a anti swim script.
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)

https://gyazo.com/bb0295f61c9822223fd286be39772c12

But i want it like this:
https://gyazo.com/82a78af9bc09bc27221b4d9b1b0c20bd

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried to look at the dev hub, I have not seen anything like this.

I have tried giving to mass. (Sinks to the bottom, Ignoring hip Hight etc.)

I have tried setting the Humandoid in the model’s HumanoidStateType, But it dosnt work either.

script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)

I have also tried using the model as a StarterCharacter but it also does not work.

See, the thing is code only runs once, so the code would stop working the moment you spawn. You want to use this code:

while true do
if script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, true) then --Checks if it's swimming
script.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false) --Turns it off immediately
end
wait(0.01) -- cooldown to prevent freezing
end

Hope this helps!

1 Like

This seems to not work, I still have the same problem of floating.

How my script works is when you join you have a gui.

Then you select a thing in the gui and it runs a spawn function.

Once the spawn function is fired on the client end it sets my camrea to my new character and on the server end it sets my character to the new model.

then it sets the model’s position to a brick.

The script is in a local script within the model.

I still currently need help with this. If you need more info please let me know.