Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local module = {}
- local debris = game:GetService("Debris")
- local ss = game:GetService("ServerStorage")
- local modules = ss:WaitForChild("Modules")
- local stunHandler = require(modules:WaitForChild("StunHandlerV2"))
- local ragdollModule = require(modules:WaitForChild("Ragdoll"):WaitForChild("ModuleScript"))
- function module.Hit(enemyHumanoid,damage,stunDuration,knockback,ragdoll,ragdollDuration)
- local enemyHumRp = enemyHumanoid.Parent.HumanoidRootPart
- if damage then
- enemyHumanoid:TakeDamage(damage)
- end
- if stunDuration then
- enemyHumanoid.WalkSpeed = 16
- enemyHumanoid.JumpPower = 50
- stunHandler.Stun(enemyHumanoid,stunDuration)
- end
- if ragdoll then
- local ragdollTrigger = enemyHumanoid.Parent:FindFirstChild("RagdollTrigger")
- if ragdollTrigger then
- if not ragdollTrigger.Value then
- ragdollTrigger.Value = true
- task.delay(ragdollDuration,function()
- if enemyHumanoid.Health > 0 then
- ragdollTrigger.Value = false
- end
- end)
- end
- end
- end
- if knockback then
- local bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,0,math.huge)
- bv.P = 50000
- bv.Velocity = knockback
- bv.Parent = enemyHumRp
- debris:AddItem(bv,0.2)
- end
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement