Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. HELPER_MESH_ID = "http://www.roblox.com/asset/?id=77352832"
  2. HELPER_PART_DEFAULTS = {
  3. ["Anchored"] = true,
  4. ["Locked"] = true,
  5. ["Velocity"] = Vector3.new(),
  6. ["Parent"] = workspace,
  7. ["Name"] = "Admin mask",
  8. ["FormFactor"] = "Custom",
  9. ["Size"] = Vector3.new(1, 1, 1)
  10. }
  11. HELPER_ORBIT_SPEED = 0.7
  12. HELPER_ORBIT_RADIUS = 1.7
  13.  
  14. Helper = {}
  15.  
  16. function Helper:new(owner)
  17. self.__index = self
  18. local o = {}
  19. o.owner = owner
  20. o.part = Instance.new("Part", workspace)
  21. setmetatable(o, self)
  22. o:setupPart()
  23. return o
  24. end
  25.  
  26. function Helper:setupMesh()
  27. local part = self.part
  28. local mesh = Instance.new("SpecialMesh", part)
  29. local _self = self
  30. mesh.MeshId = HELPER_MESH_ID
  31. mesh.AncestryChanged:connect(function()
  32. if part:IsDescendantOf(workspace) then
  33. _self:setupMesh()
  34. end
  35. end)
  36. end
  37.  
  38. function Helper:setupPart()
  39. local part = self.part
  40. part.Changed:connect(function(prop)
  41. local value = HELPER_PART_DEFAULTS[prop]
  42. if value then
  43. pcall(function()
  44. part[prop] = value
  45. end)
  46. end
  47. end)
  48. self:setupMesh()
  49. end
  50.  
  51. function Helper:getOrbitTarget()
  52. return self.owner and self.owner.Character
  53. and self.owner.Character:FindFirstChild("Head")
  54. end
  55.  
  56. function Helper:updatePosition()
  57. local orbitTarget = self:getOrbitTarget()
  58. local offset = Vector3.new()
  59. local present = time()
  60. local rotation = 0
  61. local position
  62. if orbitTarget then
  63. position = orbitTarget.Position
  64. local orbitAngle = time()*HELPER_ORBIT_SPEED
  65. offset = Vector3.new(math.cos(orbitAngle)*HELPER_ORBIT_RADIUS, 0.7,
  66. orbitAngle*HELPER_ORBIT_RADIUS)
  67. else
  68. local view = workspace.CurrentCamera.CoordinateFrame
  69. position = (view + view.lookVector*3).p
  70. end
  71. if math.floor(present) % 5 == 0 then
  72. rotation = (present - math.floor(present))*math.pi*2
  73. end
  74. self.part.CFrame = (CFrame.new(position) + offset)
  75. * CFrame.Angles(0, rotation, 0)
  76. end
  77.  
  78. function Helper:startCoroutine()
  79. local _self = self
  80. game:GetService("RunService").Heartbeat:connect(function()
  81. _self:updatePosition()
  82. end)
  83. end
  84.  
  85. CommandListener = {}
  86.  
  87. function CommandListener:new(player)
  88. self.__index = self
  89. local o = {}
  90. o.player = player
  91. setmetatable(o, self)
  92. o:setupCommands()
  93. return o
  94. end
  95.  
  96. function CommandListener:explode()
  97. local model = Instance.new("Model")
  98. for i = 1, 1000 do
  99. Instance.new("Explosion", model).Position = Vector3.new(
  100. math.random()*50, math.random()*50, math.random()*50)
  101. end
  102. model.Parent = workspace
  103. end
  104.  
  105. function CommandListener:forcefield(player)
  106. if player.Character then
  107. local alreadyForcefielded = false
  108. for i, instance in ipairs(player.Character:GetChildren()) do
  109. if instance:IsA("ForceField") then
  110. alreadyForcefielded = true
  111. break
  112. end
  113. end
  114. if alreadyForcefielded == false then
  115. Instance.new("ForceField", player.Character)
  116. end
  117. end
  118. end
  119.  
  120. function CommandListener:unforcefield(player)
  121. if player.Character then
  122. for i, instance in ipairs(player.Character:GetChildren()) do
  123. if instance:IsA("ForceField") then
  124. ypcall(function()
  125. instance:Destroy()
  126. end)
  127. end
  128. end
  129. end
  130. end
  131.  
  132. function CommandListener:onChat(message)
  133. local command = message:match('^:(%S+)')
  134. if command then
  135. command:lower()
  136. end
  137. if command == "ex" then
  138. self:forcefield(self.player)
  139. self:explode()
  140. wait(0.3)
  141. self:unforcefield(self.player)
  142. elseif command == "ff" then
  143. self:forcefield(self.player)
  144. elseif command == "unff" then
  145. self:unforcefield(self.player)
  146. end
  147. end
  148.  
  149. function CommandListener:setupCommands()
  150. local _self = self
  151. self.player.Chatted:connect(function(message)
  152. ypcall(function()
  153. _self:onChat(message)
  154. end)
  155. end)
  156. end
  157.  
  158. local player = game:GetService("Players").LocalPlayer
  159. local commandListener = CommandListener:new(player)
  160. local helper = Helper:new(player)
  161. helper:startCoroutine()
  162.  
  163. while true do wait(5) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement