Advertisement
Guest User

badge door script

a guest
Dec 1st, 2020
3,826
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. --this script was made by me and DOES WORK! just enter the badge ID into the thing that says "BadgeID"
  2. --btw you can also change the text on the thing that says text.
  3. door = script.Parent
  4. badgeholder = door.Parent.BadgeID
  5. debounce = false
  6.  
  7. function find(userid, badgeid)
  8. if game:GetService("BadgeService"):UserHasBadge(userid, badgeid) then
  9. return true
  10. else
  11. return false
  12. end
  13. end
  14.  
  15. function onTouched(hit)
  16. if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
  17. local p = game.Players:GetPlayerFromCharacter(hit.Parent)
  18. if (p ~= nil) then
  19. if (find(p.userId, badgeholder.Value)) and (debounce == false) then
  20. door.Transparency = 0.8
  21. door.CanCollide = false
  22. wait(0.3)
  23. door.Transparency = 0.5
  24. door.CanCollide = true
  25. elseif (find(p.userId, badgeholder.Value) == false) then
  26. hit.Parent.Humanoid.Health = 0
  27. end
  28. end
  29. end
  30. end
  31.  
  32. door.Touched:connect(onTouched)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement