Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RS = game:GetService("ReplicatedStorage")
- local Punch = RS:WaitForChild("Punch")
- local Debris = game:GetService("Debris")
- local Thit = script:WaitForChild("GetHit")
- local Gethit = Thit:WaitForChild("TargetHit")
- local Gethit2 = Thit:WaitForChild("TargetHit2")
- local TweenService = game:GetService("TweenService")
- local damage = 10
- local currentAtk = 0
- Punch.OnServerEvent:Connect(function(Player)
- local Character = Player.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
- local Stand = workspace:FindFirstChild(Player.Name.." Stand"):WaitForChild("Dummy")
- local folder = Instance.new("Folder",workspace)
- folder.Name = Player.Name.." Stand Punch"
- Debris:AddItem(folder,.5)
- if Stand then
- currentAtk = currentAtk + 1
- local preWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
- preWeld:Destroy()
- Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)
- local weld = Instance.new("ManualWeld")
- weld.Name = "Stand Weld"
- weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
- weld.Part1 = HumanoidRP
- weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
- weld.Parent = weld.Part0
- if currentAtk == 1 then
- local Hand = Stand:WaitForChild("Left Arm")
- local animControl = Stand:WaitForChild("AnimControl")
- local Punch = animControl:LoadAnimation(script:WaitForChild("LeftPunch"))
- Punch:Play()
- local HitBox = script:WaitForChild("HitBox"):Clone()
- HitBox.CFrame = Hand.CFrame
- HitBox.Parent = folder
- local Pweld = Instance.new("Weld")
- Pweld.Part0 = HitBox
- Pweld.Part1 = Hand
- Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
- Pweld.Parent = Pweld.Part0
- HitBox.Touched:Connect(function(Hit)
- if Hit:IsA("Part") or Hit:IsA("MeshPart") then
- if Hit.Parent ~= Character then
- local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
- local EHumanoidHit = Hit.Parent:FindFirstChild("HumanoidRootPart")
- if EHumanoid or EHumanoidHit then
- HitBox:Destroy()
- local s = Hand.Punch
- s:Play()
- EHumanoid:TakeDamage(damage)
- local act = EHumanoid:LoadAnimation(Gethit)
- act:Play()
- if Thit then
- local goal = {}
- goal.CFrame = CFrame.new((HumanoidRP.CFrame * CFrame.new(0,0,-10)).p, HumanoidRP.CFrame.p)
- local info = TweenInfo.new(.5)
- local tween = TweenService:Create(EHumanoidHit,info,goal)
- tween:Play()
- end
- end
- end
- end
- end)
- wait()
- local preWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
- preWeld:Destroy()
- Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)
- local weld = Instance.new("ManualWeld")
- weld.Name = "Stand Weld"
- weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
- weld.Part1 = HumanoidRP
- weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
- weld.Parent = weld.Part0
- elseif currentAtk == 2 then
- local Hand = Stand:WaitForChild("Right Arm")
- local animControl = Stand:WaitForChild("AnimControl")
- local Punch = animControl:LoadAnimation(script:WaitForChild("RightPunch"))
- Punch:Play()
- local HitBox = script:WaitForChild("HitBox"):Clone()
- HitBox.CFrame = Hand.CFrame
- HitBox.Parent = folder
- local Pweld = Instance.new("Weld")
- Pweld.Part0 = HitBox
- Pweld.Part1 = Hand
- Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
- Pweld.Parent = Pweld.Part0
- HitBox.Touched:Connect(function(Hit)
- if Hit:IsA("Part") or Hit:IsA("MeshPart") then
- if Hit.Parent ~= Character then
- local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
- local EHumanoidHit = Hit.Parent:FindFirstChild("HumanoidRootPart")
- if EHumanoid or EHumanoidHit then
- HitBox:Destroy()
- local s = Hand.Punch
- s:Play()
- EHumanoid:TakeDamage(damage)
- local act = EHumanoid:LoadAnimation(Gethit2)
- act:Play()
- if Thit then
- local goal = {}
- goal.CFrame = CFrame.new((HumanoidRP.CFrame * CFrame.new(0,0,-10)).p, HumanoidRP.CFrame.p)
- local info = TweenInfo.new(.5)
- local tween = TweenService:Create(EHumanoidHit,info,goal)
- tween:Play()
- end
- end
- end
- end
- end)
- wait()
- local preWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
- preWeld:Destroy()
- Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)
- local weld = Instance.new("ManualWeld")
- weld.Name = "Stand Weld"
- weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
- weld.Part1 = HumanoidRP
- weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
- weld.Parent = weld.Part0
- else
- currentAtk = 1
- local Hand = Stand:WaitForChild("Left Arm")
- local animControl = Stand:WaitForChild("AnimControl")
- local Punch = animControl:LoadAnimation(script:WaitForChild("LeftPunch"))
- Punch:Play()
- local HitBox = script:WaitForChild("HitBox"):Clone()
- HitBox.CFrame = Hand.CFrame
- HitBox.Parent = folder
- local Pweld = Instance.new("Weld")
- Pweld.Part0 = HitBox
- Pweld.Part1 = Hand
- Pweld.C0 = HitBox.CFrame:inverse() * Hand.CFrame
- Pweld.Parent = Pweld.Part0
- HitBox.Touched:Connect(function(Hit)
- if Hit:IsA("Part") or Hit:IsA("MeshPart") then
- if Hit.Parent ~= Character then
- local EHumanoid = Hit.Parent:FindFirstChild("Humanoid")
- local EHumanoidHit = Hit.Parent:FindFirstChild("HumanoidRootPart")
- if EHumanoid or EHumanoidHit then
- HitBox:Destroy()
- local s = Hand.Punch
- s:Play()
- EHumanoid:TakeDamage(damage)
- local act = EHumanoid:LoadAnimation(Gethit)
- act:Play()
- if Thit then
- local goal = {}
- goal.CFrame = CFrame.new((HumanoidRP.CFrame * CFrame.new(0,0,-10)).p, HumanoidRP.CFrame.p)
- local info = TweenInfo.new(.5)
- local tween = TweenService:Create(EHumanoidHit,info,goal)
- tween:Play()
- end
- end
- end
- end
- end)
- wait()
- local preWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
- preWeld:Destroy()
- Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * CFrame.new(0,0,0)
- local weld = Instance.new("ManualWeld")
- weld.Name = "Stand Weld"
- weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
- weld.Part1 = HumanoidRP
- weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * HumanoidRP.CFrame
- weld.Parent = weld.Part0
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement