Advertisement
IHATEMICROWAVEOVEN

touch annotated

Apr 25th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. local whostoucha = {} -- put this somewhere in the attack itself (smaller scope = less memory usage)
  2.  
  3.  
  4.  
  5. obj.Touched:Connect(function() end) -- causes the object to think about whats touching it (having a func is ok too)
  6.  
  7. coroutine.wrap(function()
  8. while true do -- do this forever:
  9. for _, i in ipairs(bigw:GetTouchingParts()) do -- look at the touching parts and for each:
  10. local humanoid = i.Parent:FindFirstChild("Humanoid") -- take the toucher's character and find a humanoid
  11. if humanoid == args[1].Humanoid then -- if the found humanoid is the boss' then:
  12. humanoid = false -- ignore it ("unfind" it and dont care)
  13. end -- end
  14. if humanoid then -- if you found the humanoid then:
  15. whostoucha[humanoid] = true -- index it in the dictionary
  16. end -- end
  17. end -- end
  18.  
  19. -- OUR TABLE LOOKS LIKE THIS RIGHT NOW:
  20. -- {Humanoid1 = true,
  21. -- Humanoid2 = true,
  22. -- Humanoid3 = true}
  23. -- ok go back to the script lol
  24. -- koishi sucks
  25.  
  26. for humanoid in pairs(whostoucha) do -- for each humanoid in the dictionary:
  27. humanoid:TakeDamage(num) -- they take damage
  28. if humanoid.Sit ~= true then -- insert a function here if you want (i have sit)
  29. humanoid.Sit = math.random(1,5) == 1 and true or false
  30. end
  31. end -- end
  32. table.clear(whostoucha) -- clear the dictionary
  33. wait(1) -- THIS WILL HAPPEN EVERY 1 SECOND
  34. end -- end
  35. end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement