Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pellet = script.Parent
- damage = 1
- local debounce = false
- function onTouched(hit)
- debounce = true
- if welded == false and hit.Parent:findFirstChild("Arrow") == nil then stick(hit) end
- humanoid = hit.Parent:findFirstChild("Enemy")
- if humanoid~=nil then
- tagHumanoid(humanoid)
- humanoid.Health = humanoid.Health - damage
- wait(2)
- untagHumanoid(humanoid)
- else
- wait(2)
- connection:disconnect()
- end
- debounce = false
- end
- function tagHumanoid(humanoid)
- -- todo: make tag expire
- local tag = pellet:findFirstChild("creator")
- if tag ~= nil then
- local new_tag = tag:clone()
- new_tag.Parent = humanoid
- end
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- connection = pellet.Touched:connect(onTouched)
- wait(2)
- if welded then wait(2) end
- pellet.Parent = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement