Advertisement
lafur

Untitled

Mar 22nd, 2019
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --@author FiredDusk (aka Previized)
  2.  
  3. --[[ NOTES:
  4.    
  5.     1. Make sure in both parts, or all parts, "Archored" and "CanCollide" are false (unchecked)
  6.    
  7. --]]
  8.  
  9. local MainPart = script.Parent.Main -- The main part that holds the weld
  10.  
  11. for i,Part in pairs(script.Parent:GetChildren()) do
  12.     if Part:IsA('Part') or Part:IsA('WedgePart') or Part:IsA('UnionOperation') or Part:IsA('MeshPart') or Part:IsA('CornerWedgePart') or Part:IsA('TrussPart') or Part:IsA('NegateOperation') then
  13.         local Weld = Instance.new('Weld',MainPart)
  14.         Weld.C0 = MainPart.CFrame:toObjectSpace(Part.CFrame)
  15.         Weld.Part0 = MainPart
  16.         Weld.Part1 = Part
  17.     end
  18. end function onTouch(part)
  19. local humanoid = part.Parent:FindFirstChild("Humanoid")
  20. if (humanoid ~= nil) then -- if a humanoid exists, then
  21. humanoid.Health = 0 -- damage the humanoid
  22. end
  23. end
  24. script.Parent.Touched:connect(onTouch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement