Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local module = {}
- module.__index = module
- local uis = game:GetService("UserInputService")
- local repStor = game:GetService("ReplicatedStorage")
- local setting = require(script.Parent.Important.Settings)
- local vM = require(script.Parent.Important.Visuals)
- local hbModule = require(script.Parent.Important.HitboxC)
- local pull = require(script.Parent.Important.Pull)
- local remotes = repStor.Remotes
- local remote = remotes.Events.M1
- local visuals = vM.setUp()
- local plr = game.Players.LocalPlayer
- local cam = workspace.CurrentCamera
- local char : Model
- local hum : Humanoid
- local anim : Animator
- local spra
- local animF = script.Parent.Important.M1_Animations
- local animT = {
- animF.Animation,
- animF.Animation2,
- animF.Animation3,
- }
- local lastPunch = tick()
- local combo = 0
- local maxCombo = #animF:GetChildren()
- local cd = false
- function module.Init(player)
- char = plr.Character or plr.CharacterAdded:Wait()
- hum = char.Humanoid
- anim = hum.Animator
- plr.CharacterAdded:Connect(function(c) char = c hum = c.Humanoid anim = c.Humanoid.Animator end)
- uis.InputBegan:Connect(function(i, g)
- if g then return end
- if i.UserInputType == setting.M1.InputKey then
- if cd == true then return end
- if tick() - lastPunch >= 1 then
- combo = 0
- lastPunch = tick()
- end
- if combo > maxCombo then
- combo = 0
- else
- combo += 1
- end
- cd = true
- print(combo)
- anim:LoadAnimation(animT[combo]):Play()
- local hitBox = hbModule.CreateHB(setting.M1.HitboxSize, hum.RootPart, 3/2, .6, hum.RootPart)
- local con
- con = hitBox.Touched:Connect(function(hit)
- if hitBox then
- if hit.Parent then
- if hit.Parent:FindFirstChildOfClass("Humanoid") then
- if hit.Parent.Name == char.Name then return end
- local human = hit.Parent:FindFirstChild("Humanoid")
- if human.Health <= 0 then return end
- remote:FireServer(human, "b")
- visuals:DamageParticles(hit.Parent.HumanoidRootPart, 3)
- pull.Pull(hum.RootPart)
- print("e")
- hitBox:Destroy()
- con:Disconnect()
- con = nil
- end
- end
- end
- end)
- game.Debris:AddItem(hitBox, .4)
- task.wait(.4)
- cd = false
- end
- end)
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment