Advertisement
brandon5487

telekinisis

Apr 18th, 2015
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.29 KB | None | 0 0
  1. inew=Instance.new
  2. v3=Vector3.new
  3. c3=Color3.new
  4. On=true
  5. Distance=20
  6. Minimum=5
  7. Maximum=10000000000000
  8. LightColor=c3(0/255,230/255,150/255)
  9. Light=inew('PointLight')
  10. Light.Color=LightColor
  11. XVec=v3(0,0,0)
  12. Target=nil
  13. Adorn=nil
  14. BP=inew("BodyPosition")
  15. BP.maxForce=v3(9990000, 9990000, 9990000)
  16. BP.P=9990000.000
  17. BP.D=100000.000
  18. BP.position=v3(0,50,0)
  19. Q=false
  20. E=false
  21. hit=nil
  22. FireSize=10
  23. FireColor=c3(255/255,255/255,255/255)
  24. FireHeat=10
  25. RunService=game:GetService('RunService')
  26. Player=game.Players.LocalPlayer
  27. Mouse=Player:GetMouse()
  28. coroutine.wrap(function()
  29. script.Parent=nil
  30. RunService.RenderStepped:connect(function()
  31. if On==false then
  32. Adorn=nil
  33. end
  34. hit=Mouse.Hit
  35. Unit=(hit.p-Player.Character.Head.Position).unit
  36. NewPos=Player.Character.Head.Position+(Unit*Distance)-XVec
  37. if BP==nil then
  38. BP=inew("BodyPosition")
  39. else
  40. BP.position=NewPos
  41. end
  42. if Adorn~=nil then
  43. BP.Parent=Adorn
  44. Light.Parent=Adorn
  45. else
  46. BP.Parent=nil
  47. Light.Parent=nil
  48. end
  49. if Mouse.Target~=nil then Target=Mouse.Target else Target=nil end                      
  50. if Q==true and E==false then
  51. if Distance-2<Minimum then
  52. Distance=Minimum
  53. elseif Distance-2>=Minimum then
  54. Distance=Distance-2
  55. end
  56. end
  57. if Q==false and E==true then
  58. if Distance+2>Maximum then
  59. Distance=Maximum
  60. elseif Distance+2<=Maximum then
  61. Distance=Distance+2
  62. end                    
  63. end    
  64. if Distance<Minimum then
  65. Distance=Minimum
  66. end    
  67. end)
  68. end)()
  69. Player.Chatted:connect(function(msg)
  70. if string.lower(string.sub(msg,1,5))=='make/' then
  71. for e=1,tonumber(string.sub(msg,6)) do
  72. local Col=Color3.new(math.random(1,255)/255,math.random(1,255)/255,math.random(1,255)/255)
  73. local br=Instance.new('Part', workspace)
  74. br.Size=Vector3.new(math.random(2,8),math.random(2,8),math.random(2,8))
  75. br.Position=Player.Character.Head.Position+ Vector3.new(math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6))), math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6))),math.random(-tonumber(string.sub(msg,6)),tonumber(string.sub(msg,6)))    )
  76. br.BrickColor=BrickColor.new(Col)
  77. end
  78. end
  79. end)
  80. Mouse.KeyDown:connect(function(key)
  81. if (key)=='q' then
  82. Q=true
  83. elseif (key)=='e' then
  84. E=true
  85. elseif (key)=='t' then
  86. if Adorn~=nil then
  87. BP.Parent=nil
  88. Adorn.Velocity=Adorn.Velocity+(((Adorn.Position+XVec)-Player.Character.Head.Position)).unit*200
  89. Adorn=nil
  90. end
  91. end
  92. end)
  93. Mouse.KeyUp:connect(function(key)
  94. if (key)=='q' then
  95. Q=false
  96. elseif (key)=='e' then
  97. E=false
  98. elseif key=='k' and Adorn~=nil then
  99. for i, v in pairs(Adorn.Parent:GetChildren()) do
  100. if v:IsA('Humanoid') then v.Health=0 end
  101. end
  102. elseif key=='b' and Adorn~=nil then
  103. Adorn:BreakJoints()
  104. elseif (key)=='r' and Adorn ~=nil then
  105. if Adorn.Parent:FindFirstChild('ThisIsAModel') and Adorn.Parent.Fire.Value==false then
  106. for i, var in pairs(Adorn.Parent:GetChildren()) do
  107. if var:IsA('BasePart') then
  108. fire=inew('Fire',var)
  109. fire.Color=FireColor
  110. fire.Name='Fire23445'
  111. fire.Size=FireSize
  112. fire.Heat=FireHeat
  113. end
  114. end
  115. Adorn.Parent.Fire.Value=true
  116. elseif Adorn.Parent:FindFirstChild('ThisIsAModel') and Adorn.Parent.Fire.Value==true then
  117. for i, var in pairs(Adorn.Parent:GetChildren()) do
  118. if var:IsA('BasePart') and var:FindFirstChild('Fire23445') then
  119. var.Fire23445:Destroy()
  120. end
  121. end
  122. Adorn.Parent.Fire.Value=false
  123. elseif not Adorn.Parent:FindFirstChild('ThisIsAModel') then
  124. if not Adorn:FindFirstChild('Fire23445') then
  125. fire=inew('Fire',Adorn)
  126. fire.Color=FireColor
  127. fire.Name='Fire23445'
  128. fire.Size=FireSize
  129. fire.Heat=FireHeat
  130. elseif Adorn:FindFirstChild('Fire23445') then
  131. Adorn.Fire23445:Destroy()
  132. end
  133. end
  134. elseif (key)=='z' and Adorn ~=nil then
  135. if Adorn.Parent:FindFirstChild('ThisIsAModel') then
  136. if Adorn.Parent.Ghost.Value==false then
  137. for i, v in pairs(Adorn.Parent:GetChildren()) do
  138. if v:IsA('BasePart') then
  139. if v.Transparency==0 then
  140. tick=inew('BoolValue',v)
  141. tick.Name='Trans'
  142. v.Transparency=0.5
  143. else
  144. v.Transparency=v.Transparency*2
  145. end
  146. end
  147. end
  148. Adorn.Parent.Ghost.Value=true
  149. elseif Adorn.Parent.Ghost.Value==true then
  150. for i, v in pairs(Adorn.Parent:GetChildren()) do
  151. if v:IsA('BasePart') then
  152. if v:FindFirstChild('Trans') then
  153. v.Transparency=0
  154. v.Trans:Destroy()
  155. else
  156. v.Transparency=v.Transparency/2
  157. end
  158. end
  159. end
  160. Adorn.Parent.Ghost.Value=false
  161. end
  162. elseif not Adorn.Parent:FindFirstChild('ThisIsAModel') then
  163. if Adorn:FindFirstChild('Trans') then
  164. Adorn.Transparency=Adorn.Transparency/2
  165. Adorn.Trans:Destroy()
  166. if Adorn:FindFirstChild('Trans2') then
  167. Adorn.Transparency=0
  168. Adorn.Trans2:Destroy()
  169. end
  170. elseif not Adorn:FindFirstChild('Trans') then
  171. inew('BoolValue',Adorn).Name='Trans'
  172. if Adorn.Transparency<=0 then
  173. inew('BoolValue',Adorn).Name='Trans2'
  174. Adorn.Transparency=0.5
  175. else Adorn.Transparency=Adorn.Transparency*2
  176. end
  177. end
  178. end
  179. end
  180. end)
  181. Mouse.Button1Down:connect(function()
  182. if Adorn==nil and BP.Parent==nil and Target~=nil and (hit.p-Player.Character.Head.Position).magnitude<=Maximum and Target:IsDescendantOf(workspace) then
  183. Distance=(Target.Position-Player.Character.Head.Position).magnitude
  184. XVec=(hit.p-Target.Position)
  185. if not Target.Parent:FindFirstChild('ThisIsAModel') then
  186. local rt=Target.Size
  187. Minimum=math.sqrt((rt.X^2+rt.Y^2+rt.Z^2))+.5
  188. else
  189. local rt=Target.Parent:GetModelSize()
  190. Minimum=math.sqrt((rt.X^2+rt.Y^2+rt.Z^2))+.5
  191. end    
  192. Adorn=Target
  193. end
  194. end)
  195.  
  196. Mouse.Button1Up:connect(function()
  197. if Adorn~=nil  then
  198. Adorn=nil
  199. BP.Parent=nil
  200. end
  201. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement