local O=game:GetService("\082\117\110\083\101\114\118\105\099\101")local D=script.Parent local g=D:WaitForChild("\072\117\109\097\110\111\105\100")local Y=D:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local B O.Heartbeat:Connect(function()if Y.Position.Y<Sea.Position.Y-Y.Size.Y/2 then if not B then B=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")B.Parent=Y end B.Velocity=g.MoveDirection*g.WalkSpeed+Vector3.new(0,4,0)if g:GetState()~=Enum.HumanoidStateType.Swimming then g:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)g:ChangeState(Enum.HumanoidStateType.Swimming)end elseif B and Y.Position.Y<Sea.Position.Y then B.Velocity=g.MoveDirection*g.WalkSpeed elseif B then B:Destroy()B=nil g:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)end end)

local RS = game:GetService("RunService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Root = Character:WaitForChild("HumanoidRootPart")
local Swim


RS.Heartbeat:Connect(function()
	if Root.Position.Y < Sea.Position.Y - Root.Size.Y / 2 then
		if not Swim then
			Swim = Instance.new("BodyVelocity")
			Swim.Parent = Root
		end
		Swim.Velocity = Humanoid.MoveDirection * Humanoid.WalkSpeed + Vector3.new(0,4,0)
		if Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
			Humanoid:ChangeState(Enum.HumanoidStateType.Swimming)
		end
	elseif Swim and Root.Position.Y < Sea.Position.Y then
		Swim.Velocity = Humanoid.MoveDirection * Humanoid.WalkSpeed
	elseif Swim then
		Swim:Destroy()
		Swim = nil
		Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
	end
end)
