Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function DamageService:RegisterHeal(Handler, Target, Heal)
- if Heal < 0 then return false end
- if DamageService:CanHeal(Handler, Target) then
- if Target:IsA'Player' then
- Target.Character.Humanoid.Health = Target.Character.Humanoid.Health + Heal
- else
- Target.Humanoid.Health = Target.Humanoid.Health + Heal
- end
- return true
- end
- return false
- end
- function DamageService:RegisterWeaponPart(Handler, Parts, Damage, OnHitFunc, Type)
- spawn(function()
- local attacktype
- if not Type then attacktype = None else
- local tupe = string.upper(tostring(Type))
- if tupe == "1" or tupe == "NOR" or tupe == "NORMAL" then attacktype = Normal end
- if tupe == "2" or tupe == "FIR" or tupe == "FIRE" then attacktype = Fire end
- if tupe == "3" or tupe == "WAT" or tupe == "WATER" then attacktype = Water end
- if tupe == "4" or tupe == "ELE" or tupe == "ELECTRIC" then attacktype = Electric end
- if tupe == "5" or tupe == "GRA" or tupe == "GRASS" then attacktype = Grass end
- if tupe == "6" or tupe == "ICE" then attacktype = Ice end
- if tupe == "7" or tupe == "FIG" or tupe == "FIGHTING" then attacktype = Fighting end
- if tupe == "8" or tupe == "POI" or tupe == "POISON" then attacktype = Poison end
- if tupe == "9" or tupe == "GRO" or tupe == "GROUND" then attacktype = Ground end
- if tupe == "10" or tupe == "FLY" or tupe == "FLYING" then attacktype = Flying end
- if tupe == "11" or tupe == "PSY" or tupe == "PSYCHIC" then attacktype = Psychic end
- if tupe == "12" or tupe == "BUG" then attacktype = Bug end
- if tupe == "13" or tupe == "ROC" or tupe == "ROCK" then attacktype = Rock end
- if tupe == "14" or tupe == "GHO" or tupe == "GHOST" then attacktype = Ghost end
- if tupe == "15" or tupe == "DRA" or tupe == "DRAGON" then attacktype = Dragon end
- if tupe == "16" or tupe == "DAR" or tupe == "DARK" then attacktype = Dark end
- if tupe == "17" or tupe == "STE" or tupe == "STEEL" then attacktype = Steel end
- if tupe == "18" or tupe == "FAI" or tupe == "FAIRY" then attacktype = Fairy end
- if attacktype == nil then attacktype = None end
- end
- local connections = {}
- local debounce = {}
- for _, Part in pairs(Parts) do
- local connection = TOUCH_MANAGER.Touched(Part, function(hit)
- if hit then
- local Player = DamageService:GetPlayer(hit)
- if Player then
- if debounce[Player.Name] == nil then
- if DamageService:RegisterDamage(Handler, Player, Damage, attacktype) then
- debounce[Player.Name] = true
- if OnHitFunc then OnHitFunc(Player) end
- end
- end
- end
- end
- end)
- end
- local count = #Parts
- repeat
- wait(1)
- count = 0
- for _, Part in pairs(Parts) do
- if Part ~= nil then
- if Part.Parent ~= nil then
- count = count + 1
- end
- end
- end
- until count == 0
- for _, connection in pairs(connections) do
- connection:Disconnect()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement