Tool=script.Parent Handle=Tool:WaitForChild("\072\097\110\100\108\101")Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")BaseUrl="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061"RbxUtility=LoadLibrary("\082\098\120\085\116\105\108\105\116\121")Create=RbxUtility.Create Particles=script:WaitForChild("\080\097\114\116\105\099\108\101\115")BasePart=(Create("\080\097\114\116"))({Shape=Enum.PartType.Block,Material=Enum.Material.Plastic,TopSurface=Enum.SurfaceType.Smooth;BottomSurface=Enum.SurfaceType.Smooth,FormFactor=Enum.FormFactor.Custom;Size=Vector3.new(.2,.2,.2),CanCollide=true,Locked=true,Anchored=false})Animations={Fly={Animation=Tool:WaitForChild("\070\108\121");FadeTime=nil;Weight=nil;Speed=nil;Duration=nil}}Sounds={}FogParticles={}Remotes=Tool:WaitForChild("\082\101\109\111\116\101\115")ServerControl=Remotes:FindFirstChild("\083\101\114\118\101\114\067\111\110\116\114\111\108")or(Create("\082\101\109\111\116\101\070\117\110\099\116\105\111\110"))({Name="\083\101\114\118\101\114\067\111\110\116\114\111\108";Parent=Remotes})ClientControl=Remotes:FindFirstChild("\067\108\105\101\110\116\067\111\110\116\114\111\108")or(Create("\082\101\109\111\116\101\070\117\110\099\116\105\111\110"))({Name="\067\108\105\101\110\116\067\111\110\116\114\111\108",Parent=Remotes})ReloadTime=1 ToolEquipped=false Handle.Transparency=0 Tool.Enabled=true function Activated()local M=InvokeClient("\077\111\117\115\101\068\097\116\097")if not M or not M.Position then return end if not Tool.Enabled or not CheckIfAlive()or not ToolEquipped then return end Tool.Enabled=false wait(ReloadTime)Tool.Enabled=true end function CheckIfAlive()return(Player and(Player.Parent and(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(RootPart and RootPart.Parent))))))))and true or false end function Equipped()Character=Tool.Parent Player=Players:GetPlayerFromCharacter(Character)Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")RootPart=Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if not CheckIfAlive()then return end ToolEquipped=true end function Unequipped()if FogLoop then FogLoop:disconnect()end for M,J in pairs(FogParticles)do if J and J.Parent then J.Enabled=false Debris:AddItem(J,3)end end FogParticles={}ToolEquipped=false end function InvokeClient(M,J)local C=nil pcall(function()C=ClientControl:InvokeClient(Player,M,J)end)return C end function OnServerInvoke(M,J,C)if M~=Player or not ToolEquipped or not CheckIfAlive()or not J or not C then return end if J=="\070\108\121\105\110\103"then local M=C.Mode for M,J in pairs(FogParticles)do if J and J.Parent then J.Enabled=false Debris:AddItem(J,3)end end FogParticles={}if FogLoop then FogLoop:disconnect()end if M then Spawn(function()InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",Animations.Fly)end)for M,J in pairs(Particles:GetChildren())do if J:IsA("\080\097\114\116\105\099\108\101\069\109\105\116\116\101\114")then local M=J:Clone()table.insert(FogParticles,M)M.Enabled=false M.Parent=RootPart end end FogLoop=RunService.Stepped:connect(function(M,J)local C=(RootPart.Velocity*Vector3.new(1,0,1)).Magnitude for M,J in pairs(FogParticles)do J.Enabled=C>15 end end)else Spawn(function()InvokeClient("\083\116\111\112\065\110\105\109\097\116\105\111\110",Animations.Fly)end)end end end ServerControl.OnServerInvoke=OnServerInvoke Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)


Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")

BaseUrl = "http://www.roblox.com/asset/?id="

RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create

Particles = script:WaitForChild("Particles")

BasePart = Create("Part"){
	Shape = Enum.PartType.Block,
	Material = Enum.Material.Plastic,
	TopSurface = Enum.SurfaceType.Smooth,
	BottomSurface = Enum.SurfaceType.Smooth,
	FormFactor = Enum.FormFactor.Custom,
	Size = Vector3.new(0.2, 0.2, 0.2),
	CanCollide = true,
	Locked = true,
	Anchored = false,
}

Animations = {
	Fly = {Animation = Tool:WaitForChild("Fly"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}
}

Sounds = {}

FogParticles = {}

Remotes = Tool:WaitForChild("Remotes")
ServerControl = (Remotes:FindFirstChild("ServerControl") or Create("RemoteFunction"){
	Name = "ServerControl",
	Parent = Remotes,
})

ClientControl = (Remotes:FindFirstChild("ClientControl") or Create("RemoteFunction"){
	Name = "ClientControl",
	Parent = Remotes,
})

ReloadTime = 1

ToolEquipped = false

Handle.Transparency = 0
Tool.Enabled = true

function Activated()
	local MouseData = InvokeClient("MouseData")
	if not MouseData or not MouseData.Position then
		return
	end
	if not Tool.Enabled or not CheckIfAlive() or not ToolEquipped then
		return
	end
	Tool.Enabled = false
	wait(ReloadTime)
	Tool.Enabled = true
end

function CheckIfAlive()
	return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and RootPart and RootPart.Parent) and true) or false)
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	RootPart = Character:FindFirstChild("HumanoidRootPart")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
end

function Unequipped()
	if FogLoop then
		FogLoop:disconnect()
	end
	for i, v in pairs(FogParticles) do
		if v and v.Parent then
			v.Enabled = false
			Debris:AddItem(v, 3)
		end
	end
	FogParticles = {}
	ToolEquipped = false
end

function InvokeClient(Mode, Value)
	local ClientReturn = nil
	pcall(function()
		ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
	end)
	return ClientReturn
end

function OnServerInvoke(player, Mode, Value)
	if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
		return
	end
	if Mode == "Flying" then
		local Mode = Value.Mode
		for i, v in pairs(FogParticles) do
			if v and v.Parent then
				v.Enabled = false
				Debris:AddItem(v, 3)
			end
		end
		FogParticles = {}
		if FogLoop then
			FogLoop:disconnect()
		end
		if Mode then
			Spawn(function()
				InvokeClient("PlayAnimation", Animations.Fly)
			end)
			for i, v in pairs(Particles:GetChildren()) do
				if v:IsA("ParticleEmitter") then
					local Particle = v:Clone()
					table.insert(FogParticles, Particle)
					Particle.Enabled = false
					Particle.Parent = RootPart
				end
			end
			FogLoop = RunService.Stepped:connect(function(Time, Step)
				local Speed = (RootPart.Velocity * Vector3.new(1, 0, 1)).Magnitude
				for i, v in pairs(FogParticles) do
					v.Enabled = (Speed > 15)
				end
			end)
		else
			Spawn(function()
				InvokeClient("StopAnimation", Animations.Fly)
			end)
		end
	end
end

ServerControl.OnServerInvoke = OnServerInvoke

Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
