Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local curtargets = {}
- -- Adding targets (other) (not damage-based)
- coroutine.wrap(function()
- while true do
- break
- end
- end)()
- -- Removing targets (other) (not sight-based)
- coroutine.wrap(function()
- while true do
- break
- end
- end)()
- -- Removing targets (on-death)
- script.Parent.Humanoid.Died:Connect(function()
- table.clear(curtargets)
- for _, i in pairs(script:GetChildren()) do
- i:Destroy()
- end
- end)
- -- Adding targets (on-hit) and removing targets (range)
- return {
- Offender = function(PlayName)
- if not table.find(curtargets,PlayName) then
- local new = Instance.new("BoolValue", script)
- new.Name = PlayName
- table.insert(curtargets,PlayName)
- end
- return nil
- end;
- Range = function(MyRange)
- coroutine.wrap(function()
- while true do
- wait(5)
- if not script.Parent:FindFirstChild("Humanoid") then break end
- for _, i in pairs(curtargets) do
- if (script.Parent.Torso.Position - workspace:FindFirstChild(i).Torso.Position).Magnitude > MyRange then
- table.remove(curtargets, table.find(curtargets,i))
- script:FindFirstChild(i):Destroy()
- end
- end
- end
- end)()
- return nil
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement