Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// Services
- local ReplicatedStorage = game:GetService('ReplicatedStorage');
- local Resources = require(ReplicatedStorage:WaitForChild('Resources'));
- local Players = game:GetService('Players')
- local LocalPlayer = Players.LocalPlayer
- --// Functions
- local RBLXTouched = {}
- RBLXTouched.__index = RBLXTouched
- function RBLXTouched:Setup(Table : {})
- if (Table) == nil or (string.lower(typeof(Table)) ~= 'table') then
- return false
- end
- setmetatable(Table, RBLXTouched)
- return Table
- end
- function RBLXTouched:IsTouchingBall()
- if (self['Force'] == nil or string.lower(typeof(self['Force'])) ~= 'function') then
- return false
- end
- if (self['Limbs'] ~= nil and string.lower(typeof(self['Limbs'])) == 'table') and (LocalPlayer.Character ~= nil) then
- local Character = LocalPlayer.Character
- local GottenLimbs = {}
- for _, v in self['Limbs'] do
- if (string.lower(typeof(v)) == 'string') then
- for i, x in Character:GetChildren() do
- if (x:IsA('Part') or x:IsA('BasePart')) then
- if (string.lower(x.Name) == string.lower(v)) then
- table.insert(GottenLimbs, x)
- end
- end
- end
- end
- end
- for _, v in GottenLimbs do
- if (v:IsA('Part') or v:IsA('BasePart')) then
- for i, x in v:GetTouchingParts() do
- if (x.Parent == nil or x.Parent.Name ~= 'MACH') then
- continue
- elseif (x:GetAttribute('Anchored') == true) then
- continue
- end
- if (self['Forces'][1] ~= nil) then
- return task.spawn(function()
- self['Forces'][1](x, v.Name)
- end)
- end
- return
- end
- end
- end
- end
- return false
- end
- function RBLXTouched:Start()
- if (self['Forces'] == nil or string.lower(typeof(self['Forces'][1])) ~= 'function') then
- return false
- elseif (self['Limbs'] ~= nil and string.lower(typeof(self['Limbs'])) == 'table') and (LocalPlayer.Character ~= nil) then
- local Character = LocalPlayer.Character
- local GottenLimbs = {}
- for _, v in self['Limbs'] do
- if (string.lower(typeof(v)) == 'string') then
- for i, x in Character:GetChildren() do
- if (x:IsA('Part') or x:IsA('BasePart')) then
- if (string.lower(x.Name) == string.lower(v)) then
- table.insert(GottenLimbs, x)
- end
- end
- end
- end
- end
- for _, v in GottenLimbs do
- if (v:IsA('Part') or v:IsA('BasePart')) then
- v.Touched:Connect(function(Ball)
- if not (self['Kick']) then
- return false
- elseif (Ball.Parent ~= nil and Ball.Parent.Name == 'MACH') then
- if (Ball:GetAttribute('Anchored') == true) then
- return false
- end
- if (self['Forces'][1] ~= nil) then
- return coroutine.wrap(function()
- return task.spawn(function()
- self['Forces'][1](Ball, v.Name)
- end)
- end)()
- end
- elseif (self['Shield'] ~= nil and self['Shield']) and (Ball.Name == 'Shield' and (string.lower(Ball.Parent.Name) ~= string.lower(LocalPlayer.Name))) then
- if (self['Forces'][2] ~= nil) then
- return coroutine.wrap(function()
- return task.spawn(function()
- self['Forces'][2]()
- end)
- end)()
- end
- end
- return true
- end)
- end
- end
- end
- end
- return RBLXTouched
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement