I have this swim script that isn’t working. I didn’t want swimming like how roblox has it, or water like roblox. So I wanted the ocean to be a part and I wanted the player float at the top and play a swim animation.
Similar to this video:
if LowerTorso:FindFirstChild("Smoke")==nil then
local s=Instance.new("Smoke")
s.Parent=LowerTorso
s.Color=Color3.new(0,0.4,0.6)
s.Opacity=0
s.RiseVelocity=0
s.Size=0.5
end
if LowerTorso:FindFirstChild("Floater")==nil then
local B=Instance.new("BodyPosition")
B.Parent=LowerTorso
B.position=Vector3.new(0,0,0)
B.maxForce=Vector3.new(0,0,0)
B.P=400
B.D=200
B.Name="Floater"
v.Character.Humanoid.Changed:connect(function(val) if val=="Jump" and v.Character.Humanoid.Jump==true then Jump(v.Character) v.Character.Humanoid.Jump=false end end)
end
local ypos=LowerTorso.Position.y
local B=LowerTorso.Floater
if ypos<sealevel then
LowerTorso.Smoke.Opacity=0.2
B.position=Vector3.new(0,sealevel-1,0)
B.maxForce=Vector3.new(0,100000,0)
v.Character.Humanoid.WalkSpeed=8
v.Character.Humanoid.Health=v.Character.Humanoid.Health-0
else
LowerTorso.Smoke.Opacity=0
local B=LowerTorso.Floater
B.maxForce=Vector3.new(0,0,0)
v.Character.Humanoid.WalkSpeed=14
end
end
end
wait(.2)
end
I tried to implement a system similar to this but doesn’t work. If I jump into the water I just fall through it. I also do get an error:
If anyone could help me fix this I would appreciate it.