Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local humanoid = script.Parent:WaitForChild('Humanoid')
- local torso = script.Parent:WaitForChild('UpperTorso')
- local character = script.Parent
- local data = script.Parent.AnimationData
- local debounce = false
- local damage = 60
- local waitTime = 2
- local anim = humanoid:LoadAnimation(data:WaitForChild('Attack'))
- local function wait(TimeToWait)
- if TimeToWait ~= nil then
- local TotalTime = 0
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- while TotalTime < TimeToWait do
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- end
- else
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- function findTarget()
- local target
- local dist = 200
- for _, p in pairs(workspace:GetChildren()) do
- if p:IsA('Model')
- and p ~= script.Parent
- and p.Name ~= 'SCP-008 Infected'
- and p.Name ~= '[INFECTED]'.. script.Parent.Name
- and p.Name ~= 'SCP-049'
- and p.Name ~= 'SCP-049-2'
- and p.Name ~= 'SCP-053'
- and p.Name ~= 'SCP-058'
- and p.Name ~= 'SCP-073'
- and p.Name ~= 'SCP-076-2'
- and p.Name ~= 'SCP-096'
- and p.Name ~= 'SCP-105'
- and p.Name ~= 'SCP-106'
- and p.Name ~= 'SCP-178-1'
- and p.Name ~= 'SCP-372'
- and p.Name ~= 'SCP-457'
- and p.Name ~= 'SCP-513-1'
- and p.Name ~= 'SCP-682'
- and p.Name ~= 'SCP-860-2'
- and p.Name ~= 'SCP-939'
- and p.Name ~= 'SCP-953'
- and p.Name ~= 'SCP-966'
- and p.Name ~= 'SCP-1048'
- and p.Name ~= 'SCP-1048-A' then
- local h = p:FindFirstChild('Humanoid')
- if h and h.Health > 0 then
- if h.RigType == Enum.HumanoidRigType.R6 then
- local t = p:FindFirstChild('Torso')
- if t and (t.Position - torso.Position).magnitude <= dist then
- target = t
- dist = (t.Position - torso.Position).magnitude
- end
- elseif h.RigType == Enum.HumanoidRigType.R15 then
- local t = p:FindFirstChild('UpperTorso')
- if t and (t.Position - torso.Position).magnitude <= dist then
- target = t
- dist = (t.Position - torso.Position).magnitude
- end
- end
- end
- end
- end
- return target
- end
- for _, part in pairs(script.Parent:GetChildren()) do
- if part:IsA('BasePart') then
- part.Touched:connect(function(hit)
- if humanoid.Health > 0
- and not debounce
- and hit.Parent.Name ~= 'SCP-008 Infected'
- and hit.Parent.Name ~= 'SCP-049'
- and hit.Parent.Name ~= 'SCP-049-2'
- and hit.Parent.Name ~= 'SCP-053'
- and hit.Parent.Name ~= 'SCP-058'
- and hit.Parent.Name ~= 'SCP-073'
- and hit.Parent.Name ~= 'SCP-076-2'
- and hit.Parent.Name ~= 'SCP-096'
- and hit.Parent.Name ~= 'SCP-105'
- and hit.Parent.Name ~= 'SCP-106'
- and hit.Parent.Name ~= 'SCP-178-1'
- and hit.Parent.Name ~= 'SCP-372'
- and hit.Parent.Name ~= 'SCP-457'
- and hit.Parent.Name ~= 'SCP-513-1'
- and hit.Parent.Name ~= 'SCP-682'
- and hit.Parent.Name ~= 'SCP-860-2'
- and hit.Parent.Name ~= 'SCP-939'
- and hit.Parent.Name ~= 'SCP-953'
- and hit.Parent.Name ~= 'SCP-966'
- and hit.Parent.Name ~= 'SCP-1048'
- and hit.Parent.Name ~= 'SCP-1048-A' then
- local h = hit.Parent:FindFirstChild('Humanoid')
- if h and h.Health > 0 then
- debounce = true
- h:TakeDamage(damage)
- if not hit.Parent:FindFirstChild('SCP008Effect') then
- local scr = script.SCP008Effect:Clone()
- scr.Parent = hit.Parent
- scr.Disabled = false
- end
- anim:Play(nil, nil, 2)
- torso['Attack'..math.random(1, 3)]:Play()
- wait(waitTime)
- debounce = false
- end
- end
- end)
- end
- end
- humanoid.Died:connect(function()
- wait(5)
- script.Parent:Destroy()
- end)
- humanoid.Changed:Connect(function()
- if humanoid.Sit then wait(5) humanoid.Sit = false end
- if humanoid.PlatformStand then wait(5) humanoid.PlatformStand = false end
- end)
- while humanoid.Health > 0 do
- wait(0.1)
- local target = findTarget()
- if target then
- humanoid:MoveTo(target.Position)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement