--

script.Parent.OnServerEvent:Connect(function(p)
	local Character = p.Character
	local Humanoid = Character.Humanoid
	local RootPart = Character.HumanoidRootPart
	local anim = Humanoid:LoadAnimation(script.Punch)
	local run = Humanoid:LoadAnimation(script.Run)
	local FX = Assets.CompassNeedle:Clone()
	anim:Play()
	FX.sfx.Playing = true
	local vel = Instance.new("BodyVelocity", p.Character.Torso)
	vel.MaxForce = Vector3.new(1,1,1) * 1000000;
	vel.Parent = p.Character.Torso
	vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
	vel.Name  =  "SmallMoveVel"
	game.Debris:AddItem(vel,8.3)
	FX.CFrame = RootPart.CFrame * CFrame.new(0,0,0)
	FX.Parent = workspace.Effects
	wait(.2)
	FX.CFrame = RootPart.CFrame * CFrame.new(0,0,0)
	wait(4)
	FX.CanCollide = false
	FX.CastShadow = false
	FX.Anchored = true
	FX.Parent = workspace.Effects
	FX.Transparency = 1
	wait(0.05)
	local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(20,20,20))
	local hitlist = {}
	for _,v in pairs(hitcontent) do
		if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
			if not hitlist[v.Parent.Humanoid] then
				hitlist[v.Parent.Humanoid] = true
				v.Parent.Humanoid:TakeDamage(50)
				v.Parent.Torso.CFrame = CFrame.lookAt(v.Parent.Torso.Position, p.Character.Torso.Position)

				local vel = Instance.new("BodyVelocity", v.Parent.Torso)
				vel.MaxForce = Vector3.new(1,1,1) * 1000000;
				vel.Parent = v.Parent.Torso
				vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 115
				vel.Name  =  "SmallMoveVel"
				game.Debris:AddItem(vel,0.4)
				local HitFX = Assets.HitFX.Attachment:Clone()
				HitFX.Parent = v.Parent.Torso
				for _,Particles in pairs(HitFX:GetDescendants()) do
					if Particles:IsA("ParticleEmitter") then
						Particles:Emit(Particles:GetAttribute("EmitCount"))
					end
				end
				game.Debris:AddItem(HitFX,3)
			end
		end
	end
	wait(4)
	anim:Stop()
	Humanoid.WalkSpeed = 65
	run:Play()
	run:AdjustSpeed(2)
	wait(1)
	Humanoid.WalkSpeed = 16
	run:Stop()
	wait(3)
	FX:Destroy()
	--RootPart.Anchored = false
end)
