local P=game:GetService("\068\101\098\114\105\115")local x=game.ReplicatedStorage.Skill:FindFirstChild(skillName)local g=true local U=false script.Parent.SkillEvent.OnServerEvent:Connect(function(E,s,F,y)if g==true then g=false local w=x:Clone()w.Parent=game.Workspace.SkillPart w.Position=Vector3.new(s,F+.01,y)local u=game.ReplicatedStorage.Skill.Part1:Clone()u.Transparency=1 u.Parent=game.Workspace.SkillPart u.Position=Vector3.new(s,F,y)w.Touched:Connect(function(P)local x=P.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local g=P.Parent.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")if x~=nil and P.Parent then if P.Parent.Name==script.Parent.Parent.Name and U==false then return end if x and U==false then U=true x:TakeDamage(Damage)wait(DamageCoolTime)U=false elseif g and U==false then U=true g:TakeDamage(Damage)wait(DamageCoolTime)U=false end end end);(script.Parent.Handle:FindFirstChild(Sound)):Play()script.Parent.SkillEvent:FireClient(E)while u.Transparency>=0 do u.Transparency=u.Transparency-.1 wait()end wait(2)while u.Transparency<=1 do u.Transparency=u.Transparency+.1 wait()end P:AddItem(u,3)while w.Transparency<=1 do w.Transparency=w.Transparency+.1 wait()end P:AddItem(w,Delete)wait(CoolTime)g=true end end)


local ser = game:GetService("Debris")
local skill = game.ReplicatedStorage.Skill:FindFirstChild(skillName) --스킬 찾기
local Cooldown = true
local DamageCool = false

script.Parent.SkillEvent.OnServerEvent:Connect(function(plr, X, Y, Z) --플레이어가 스킬을 클릭하면
	if Cooldown == true then
		Cooldown = false

		local clone = skill:Clone() --스킬 복사
		clone.Parent = game.Workspace.SkillPart --스킬 적용
		clone.Position = Vector3.new(X, (Y + 0.01), Z) --스킬 위치를 플레이어가 터치한 자리에
		
		local clone2 = game.ReplicatedStorage.Skill.Part1:Clone()
		clone2.Transparency = 1
		clone2.Parent = game.Workspace.SkillPart
		clone2.Position = Vector3.new(X, Y, Z)
		
		clone.Touched:Connect(function(hit) --다른 플레이어가 스킬에 닿이면
			local human = hit.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기
			local human2 = hit.Parent.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기

			if human ~= nil and hit.Parent then
				if hit.Parent.Name == script.Parent.Parent.Name and DamageCool == false then return	end

				if human and DamageCool == false then --해당 조건이 맞으면

					DamageCool = true
					human:TakeDamage(Damage) --데미지 입히기
					wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
					DamageCool = false

				elseif human2 and DamageCool == false then

					DamageCool = true
					human2:TakeDamage(Damage) --데미지 입히기
					wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
					DamageCool = false
				end
			end 
		end) --끝
		
		script.Parent.Handle:FindFirstChild(Sound):Play() --오디오 틀기
		script.Parent.SkillEvent:FireClient(plr)

		while clone2.Transparency >= 0 do --서서히 나타나는
			clone2.Transparency = clone2.Transparency - 0.1
			wait()
		end
		
		wait(2)
		
		while clone2.Transparency <= 1 do --서서히 사라지는
			clone2.Transparency = clone2.Transparency + 0.1
			wait()
		end

		ser:AddItem(clone2, 3)
		
		while clone.Transparency <= 1 do --서서히 사라지는
			clone.Transparency = clone.Transparency + 0.1
			wait()
		end
		
		ser:AddItem(clone, Delete) --초뒤 스킬 삭제

		wait(CoolTime) --스킬 쿨타임 기다리기
		Cooldown = true
	end
end) --끝
