local t=script.Parent local Z=t:WaitForChild("\072\097\110\100\108\101")local u=Z:WaitForChild("\067\111\105\108\083\111\117\110\100")local B=game.Players.LocalPlayer.Character local a=B.Humanoid.Head EqualizingForce=196.66666666667 Gravity=.85 GhostEffect=nil MassCon1=nil MassCon2=nil function GetTotalMass(t)local Z=0 for t,u in pairs(t:GetChildren())do if u:IsA("\066\097\115\101\080\097\114\116")then Z=Z+(u:GetMass()*EqualizingForce)*Gravity end Z=Z+GetTotalMass(u)end return Z end function OnMassChanged(t,Z)if GhostEffect and GhostEffect.Parent then GhostEffect.force=Vector3.new(0,GetTotalMass(B),0)end end function UpdateGhostState(t)if t then GhostEffect:Destroy()GhostEffect=nil MassCon1:disconnect()MassCon2:disconnect()else if not GhostEffect then GhostEffect=Instance.new("\066\111\100\121\070\111\114\099\101")GhostEffect.Name="\071\114\097\118\105\116\121\067\111\105\108\069\102\102\101\099\116"GhostEffect.force=Vector3.new(0,GetTotalMass(B),0)GhostEffect.Parent=a MassCon1=B.ChildAdded:connect(function(t)OnMassChanged(t,B)end)MassCon2=B.ChildRemoved:connect(function(t)OnMassChanged(t,B)end)end end end function OnEquipped()B=t.Parent a=B:FindFirstChild("\072\101\097\100")if not a or not a.Parent then return end u:Play()UpdateGhostState(false)end function OnUnequipped()UpdateGhostState(true)end t.Equipped:connect(OnEquipped)t.Unequipped:connect(OnUnequipped)
--Made by Luckymaxer

local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local CoilSound = Handle:WaitForChild("CoilSound")
local Character = game.Players.LocalPlayer.Character
local Head = Character.Humanoid.Head

EqualizingForce = (236 / 1.2) -- amount of force required to levitate a mass
Gravity = 0.85 -- things float at > 1

GhostEffect = nil
MassCon1 = nil
MassCon2 = nil

function GetTotalMass(root)
	local force = 0

	for _, obj in pairs(root:GetChildren()) do
		if obj:IsA("BasePart") then
			force = force + obj:GetMass() * EqualizingForce * Gravity
		end
		force = force + GetTotalMass(obj)
	end

	return force
end

function OnMassChanged(child, character)
	if GhostEffect and GhostEffect.Parent then
		GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0)
	end
end

function UpdateGhostState(Unequipped)
	if Unequipped then
		GhostEffect:Destroy()
		GhostEffect = nil
		MassCon1:disconnect()
		MassCon2:disconnect()
	else
		if not GhostEffect then
			GhostEffect = Instance.new("BodyForce")
			GhostEffect.Name = "GravityCoilEffect"
			GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0)
			GhostEffect.Parent = Head
			MassCon1 = Character.ChildAdded:connect(function(Child)
				OnMassChanged(Child, Character)
			end)
			MassCon2 = Character.ChildRemoved:connect(function(Child)
				OnMassChanged(Child, Character)
			end)
		end
	end
end

function OnEquipped()
	Character = Tool.Parent
	Head = Character:FindFirstChild("Head")
	if not Head or not Head.Parent then
		return
	end
	CoilSound:Play()
	UpdateGhostState(false)
end

function OnUnequipped()
	UpdateGhostState(true)
end

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
