Advertisement
Guest User

KillScript

a guest
May 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local clone = script.Parent.CloneBool
  2. local distance = 0
  3.  
  4. -- Function to move our killblock
  5. function move()
  6.     if clone.Value == true then
  7.         script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0,0,1)
  8.         wait (0.000001)
  9.        
  10.         -- Once 1000 distance is covered, destroy the object
  11.         distance = distance + 1
  12.         --Add in an if statement that destroys the object after a set of value is traveled
  13.         if distance >= 1000 then
  14.             script.Parent:Destroy()
  15.         end
  16.     end
  17.    
  18. end
  19. game:GetService('RunService').Heartbeat:Connect(move)
  20.  
  21. -- Function to kill the player on touch
  22. function kill(part)
  23.     local humanoid = part.Parent:FindFirstChild('Humanoid')
  24.     -- If it is a humanoid, reduce health to 0
  25.     if humanoid then
  26.         humanoid:TakeDamage(humanoid.Health)
  27.     end
  28. end
  29. script.Parent.Touched:Connect(kill)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement