function GetBaseSize()local Y=Vector3.new(0,0,0)local Q=Self.Size local J=Self:findFirstChild("\077\101\115\104")if J~=nil then Y=Vector3.new(Q.X*J.Scale.X,Q.Y*J.Scale.Y,Q.Z*J.Scale.Z)else Y=Q end return Y end function GetBasePosition()local Y=Vector3.new(0,0,0)local Q=Self.Position local J=Self:findFirstChild("\077\101\115\104")if J~=nil then Y=Vector3.new(Q.X+J.Offset.X,Q.Y+J.Offset.Y,Q.Z+J.Offset.Z)else Y=Q end return Y end local Y=GetBaseSize()local Q=GetBasePosition()function CheckMats(Y)local Q=false for J=1,#FloatMats,1 do if Y.Material==Enum.Material[FloatMats[J]]then Q=true end end return Q end function isinArea(J)isIT=false if J~=nil then local p=Y local H=J.Size local V=Q local n=J.Position if n.Y+H.Y/2>V.Y-p.Y/2 and n.Y-H.Y/2<V.Y+p.Y/2 then if n.X+H.X/2>V.X-p.X/2 and n.X-H.X/2<V.X+p.X/2 then if n.Z+H.Z/2>V.Z-p.Z/2 and n.Z-H.Z/2<V.Z+p.Z/2 then isIT=true end end end end return isIT end while true do for J=1,#WorkSpaceObjects,1 do if WorkSpaceObjects[J]~=nil then if WorkSpaceObjects[J].Parent~=nil then if CheckMats(WorkSpaceObjects[J])==true then if WorkSpaceObjects[J]:findFirstChild("\066\111\121\097\110\099\121\084\105\109\101\115")~=nil then Mass=WorkSpaceObjects[J]:GetMass()*(230*WorkSpaceObjects[J].BoyancyTimes.Value)else Mass=WorkSpaceObjects[J]:GetMass()*230 end else Mass=WorkSpaceObjects[J]:GetMass()*150 end inArea=isinArea(WorkSpaceObjects[J])BoyantPos_Y=Q.Y+Y.Y/2 if inArea==true then if WorkSpaceObjects[J]:findFirstChild("\087\097\116\101\114\070\111\114\099\101")==nil then BP=Instance.new("\066\111\100\121\080\111\115\105\116\105\111\110")BP.Parent=WorkSpaceObjects[J]BP.Name="\087\097\116\101\114\070\111\114\099\101"if WorkSpaceObjects[J].Parent:findFirstChild("\072\117\109\097\110\111\105\100")~=nil then BP.D=12500.0 BP.P=100000.0 BP.position=Vector3.new(0,BoyantPos_Y+25,0)BP.maxForce=Vector3.new(0,Mass*1.5,0)else BP.D=1250.0 BP.P=10000.0 BP.position=Vector3.new(0,BoyantPos_Y,0)BP.maxForce=Vector3.new(0,Mass,0)end end if WorkSpaceObjects[J]:findFirstChild("\087\097\116\101\114\070\111\114\099\101")~=nil then if WorkSpaceObjects[J].Parent:findFirstChild("\072\117\109\097\110\111\105\100")~=nil then BP=WorkSpaceObjects[J].WaterForce if WorkSpaceObjects[J].Parent.Humanoid.Jump==true then BP.position=Vector3.new(0,BoyantPos_Y+50,0)BP.maxForce=Vector3.new(0,Mass*4,0)tick=tick+1 if tick>=resetTick then tick=0 WorkSpaceObjects[J].Parent.Humanoid.Jump=false end else BP.position=Vector3.new(0,BoyantPos_Y+1,0)BP.maxForce=Vector3.new(0,Mass*2,0)end end end else if WorkSpaceObjects[J]~=nil then if WorkSpaceObjects[J]:findFirstChild("\087\097\116\101\114\070\111\114\099\101")~=nil then WorkSpaceObjects[J].WaterForce:remove()end end end end end end wait()end

function GetBaseSize()
	local Size = Vector3.new(0,0,0)
	local mySize = Self.Size
	local Mesh = Self:findFirstChild("Mesh")
	if(Mesh ~= nil) then
		Size = Vector3.new((mySize.X*Mesh.Scale.X),
								 (mySize.Y*Mesh.Scale.Y),
								 (mySize.Z*Mesh.Scale.Z))
	else
		Size = mySize
	end
	return Size
end

function GetBasePosition()
	local Pos = Vector3.new(0,0,0)
	local myPos = Self.Position
	local Mesh = Self:findFirstChild("Mesh")
	if(Mesh ~= nil) then
		Pos = Vector3.new((myPos.X+Mesh.Offset.X),
								(myPos.Y+Mesh.Offset.Y),
								(myPos.Z+Mesh.Offset.Z))
	else
		Pos = myPos
	end
	return Pos
end
local AreaOfEffect = GetBaseSize()
local MyBasePos = GetBasePosition()
function CheckMats(part)
	local isBoyant = false
	for i=1,#FloatMats do
		if(part.Material == Enum.Material[FloatMats[i]]) then
			isBoyant = true
		end
	end
	return isBoyant
end
function isinArea(part) --main function to check if parts are within an area
	isIT = false
	if(part~= nil) then
		local Area = AreaOfEffect
		local PartSize = part.Size
		local MyPos = MyBasePos
		local PartPos = part.Position
		if((PartPos.Y+(PartSize.Y/2) > MyPos.Y-(Area.Y/2))
		and(PartPos.Y-(PartSize.Y/2) < MyPos.Y+(Area.Y/2))) then
			if((PartPos.X+(PartSize.X/2) > MyPos.X-(Area.X/2))
			and(PartPos.X-(PartSize.X/2) < MyPos.X+(Area.X/2))) then 
				if((PartPos.Z+(PartSize.Z/2) > MyPos.Z-(Area.Z/2))
				and(PartPos.Z-(PartSize.Z/2) < MyPos.Z+(Area.Z/2))) then -- should be in the volume
					isIT = true
				end
			end
		end
	end
	return isIT
end
while true do
	for i =1,#WorkSpaceObjects do
		if(WorkSpaceObjects[i] ~= nil)then
			if(WorkSpaceObjects[i].Parent ~= nil) then
				if(CheckMats(WorkSpaceObjects[i]) == true) then
					if(WorkSpaceObjects[i]:findFirstChild("BoyancyTimes")~= nil) then
						Mass = WorkSpaceObjects[i]:GetMass()*(230*WorkSpaceObjects[i].BoyancyTimes.Value)
					else
						Mass = WorkSpaceObjects[i]:GetMass()*230
					end
				else
					Mass = WorkSpaceObjects[i]:GetMass()*150
				end
				inArea = isinArea(WorkSpaceObjects[i])
				BoyantPos_Y = MyBasePos.Y + ((AreaOfEffect.Y/2))
				if(inArea == true) then
					if(WorkSpaceObjects[i]:findFirstChild("WaterForce") == nil) then
						BP = Instance.new("BodyPosition")
						BP.Parent = WorkSpaceObjects[i]
						BP.Name = "WaterForce"
						if(WorkSpaceObjects[i].Parent:findFirstChild("Humanoid") ~= nil) then
							BP.D = 1.25e+004
							BP.P = 1e+005
							BP.position=Vector3.new(0,BoyantPos_Y+25,0)
							BP.maxForce = Vector3.new(0,Mass*1.5,0)
						else
							BP.D = 1.25e+003
							BP.P = 1e+004
							BP.position=Vector3.new(0,BoyantPos_Y,0)
							BP.maxForce = Vector3.new(0,Mass,0)
						end
					end
					if(WorkSpaceObjects[i]:findFirstChild("WaterForce") ~= nil) then
						if(WorkSpaceObjects[i].Parent:findFirstChild("Humanoid") ~= nil) then
							BP = WorkSpaceObjects[i].WaterForce
							if(WorkSpaceObjects[i].Parent.Humanoid.Jump == true) then
								BP.position=Vector3.new(0,BoyantPos_Y+50,0)
								BP.maxForce = Vector3.new(0,Mass*4,0)
								tick = tick +1
								if(tick >= resetTick) then
									tick = 0
									WorkSpaceObjects[i].Parent.Humanoid.Jump = false 
								end
							else
								BP.position=Vector3.new(0,BoyantPos_Y+1,0)
								BP.maxForce = Vector3.new(0,Mass*2,0)
							end
						end
					end
				else
					if(WorkSpaceObjects[i] ~= nil)then
						if(WorkSpaceObjects[i]:findFirstChild("WaterForce") ~= nil) then
							WorkSpaceObjects[i].WaterForce:remove()
						end
					end
				end
			end
		end
	end
	--print(#WorkSpaceObjects)
	wait()
end
