Hi, I released a module to make your parts float in this water: Simple Floating Module
If there are lag issues it’s probably related to the zone+ module I use to detect contact witht the water. Unfortunately I can’t do anything about that.
hello, is it possible to make custom swimming animations for r6 with this script?
No, but you can make your own by checking if the humanoid state is swimming and then applying the animation.
Doing this might be better tho:
It actually is possible I did it for my game, you have to make ur game R15 to copy the animate script and then copy the chunk of code for swimming animations in R15 animate and add it into the R6 animate script. And copy the part where you put the swim anim ids and some other stuff, pretty easy.
i added a simple input check that tracks if the player is holding down a movement key in the water part, then applies a custom animation if they do so. if not, it applies a custom idle animation. thanks for the advice though still.
I want to use this, but in my game the swimmable parts are only loaded AFTER the script has run. If I put just one swimmable part in workspace and then load the part in after and add the CollectionService tag, will it still work?
It should work, tell me if it doesn’t
I was using this in my game a few days ago and everything worked perfectly but recently
a few issues came up. First unlike real water terrian when you are moving inside of the part for some reason my player drifts around especially when I change directions. Another issue I am having is how fast the player can swim upwards out of the water. I am not sure if these issues are just for me but this is a normal baseplate with no modifications.
hey! i had the same problem but after hours of debugging i’ve finally found a solution that closely resemble to the original condition
so i edited the part for the going up forces inside the HighWaterPerformance script into this:
local additionRatioMult = 3
if table.find(getKeycodesPressed(), Enum.KeyCode.Space) or table.find(getKeycodesPressed(), Enum.KeyCode.ButtonA) then
local force = hrp:FindFirstChildOfClass("VectorForce")
if force then
force.Force = Vector3.new(0, defaultForce * script:WaitForChild("Configuration"):GetAttribute("CharDensityUp") * (hum.WalkSpeed/16 * additionRatioMult), 0) --force that make you go up by pressing space
end
else
local force = hrp:FindFirstChildOfClass("VectorForce")
if force then
if hum.MoveDirection.Magnitude == 0 then
if isHeadIn then
force.Force = Vector3.new(0, defaultForce * script:WaitForChild("Configuration"):GetAttribute("CharDensity") * hum.WalkSpeed, 0) --force that makes you go up by being idle
end
else
force.Force = Vector3.new(0, defaultForce, 0) --force that makes you stay still when floating in the surface
end
end
end
I added additionRatioMult just for comfy purposes, you can just increase the chardensityup if you’d like to. also feel free to change additionRatioMult to your liking.
And also in the SwimModule script i edited the Start Method into this:
function swimModule:Start()
if runService:IsServer() then return end
if self.Enabled then return end
humStates(false, Enum.HumanoidStateType.Swimming) --deactivates the necessary states for swimming to be the priority
local attachment, force = antiGrav(true) --creates the anti grav forces
self.Enabled = true
self.RSConnection = runService.Heartbeat:Connect(function()
if hum.MoveDirection.Magnitude > 0 then
hrp.AssemblyLinearVelocity = Vector3.new(hum.MoveDirection.X * hum.WalkSpeed, hum.MoveDirection.Y * hum.WalkSpeed , hum.MoveDirection.Z * hum.WalkSpeed) --keeps player moving cohesively by their walkspeed
else
hrp.AssemblyLinearVelocity = Vector3.new(0, 0, 0) --resets any kind of build up velocity
end
end)
end
All i changed was the runservice.Heartbeat part
Hope this helps and please correct me if i did any mistakes!
if u swim upwards and press space at the same time it flings you up
does this work with NPCS? onlythirtycharacters
If you change your start function in the swimModule script it will resolve this
hey, I’m having a problem. so when the swimmable part gets added, when I try to swim in it. there’s a small lag spike and I just fall though it. it works when I reset my character if there’s already the swimmable part in the workspace. here’s a clip of how it looks