Advertisement
Animescapetower

Spam Dodgeball

Jun 30th, 2018
3,874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Tool0 = Instance.new("Tool")
  19. Script1 = Instance.new("Script")
  20. Part2 = Instance.new("Part")
  21. Sound3 = Instance.new("Sound")
  22. Sound4 = Instance.new("Sound")
  23. Sound5 = Instance.new("Sound")
  24. BillboardGui6 = Instance.new("BillboardGui")
  25. TextLabel7 = Instance.new("TextLabel")
  26. SpecialMesh8 = Instance.new("SpecialMesh")
  27. LocalScript9 = Instance.new("LocalScript")
  28. LocalScript10 = Instance.new("LocalScript")
  29. Tool0.Name = "CB{Cylinderball}"
  30. Tool0.Parent = mas
  31. Tool0.ToolTip = "It kinda looks like wheels"
  32. Tool0.CanBeDropped = false
  33. Script1.Name = "CannonBall"
  34. Script1.Parent = Tool0
  35. Script1.Disabled = true
  36. table.insert(cors,sandbox(Script1,function()
  37. local Ball = script.Parent
  38. local damage = 10
  39. local r = game:service("RunService")
  40. local debris = game:GetService("Debris")
  41.  
  42. local last_sound_time = r.Stepped:wait()
  43.  
  44. function onTouched(hit)
  45. if hit.Parent == nil then return end
  46. local now = r.Stepped:wait()
  47. if (now - last_sound_time > .1) then
  48. Ball.Boing:play()
  49. last_sound_time = now
  50. else
  51. return
  52. end
  53. local humanoid = hit.Parent:FindFirstChild("Humanoid")
  54. if humanoid ~=nil then
  55. tagHumanoid(humanoid)
  56. humanoid:TakeDamage(damage)
  57. if connection then connection:disconnect() end
  58. else
  59. damage = damage / 2
  60. if damage < 2 then
  61. if connection then connection:disconnect() end
  62. end
  63. end
  64. end
  65.  
  66. function tagHumanoid(humanoid)
  67. local tag = Ball:findFirstChild("creator")
  68. if tag ~= nil then
  69. local new_tag = tag:clone()
  70. new_tag.Parent = humanoid
  71. debris:AddItem(new_tag, 2)
  72. end
  73. end
  74.  
  75. connection = Ball.Touched:connect(onTouched)
  76.  
  77. t, s = r.Stepped:wait()
  78. d = t + 10 - s
  79. while t < d do
  80. t = r.Stepped:wait()
  81. end
  82.  
  83. Ball.Parent = nil
  84. end))
  85. Part2.Name = "Handle"
  86. Part2.Parent = Tool0
  87. Part2.Material = Enum.Material.Glass
  88. Part2.BrickColor = BrickColor.new("Bright red")
  89. Part2.Rotation = Vector3.new(-180, 0, -180)
  90. Part2.Elasticity = 1
  91. Part2.FormFactor = Enum.FormFactor.Symmetric
  92. Part2.Friction = 0
  93. Part2.Shape = Enum.PartType.Ball
  94. Part2.Size = Vector3.new(2, 2, 2)
  95. Part2.CFrame = CFrame.new(0, 2, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  96. Part2.BottomSurface = Enum.SurfaceType.Smooth
  97. Part2.TopSurface = Enum.SurfaceType.Smooth
  98. Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
  99. Part2.Position = Vector3.new(0, 2, 0)
  100. Part2.Orientation = Vector3.new(0, 180, 0)
  101. Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
  102. Sound3.Name = "Boing"
  103. Sound3.Parent = Part2
  104. Sound3.Pitch = 1.1000000238419
  105. Sound3.SoundId = "http://www.roblox.com/Asset?ID=96543718"
  106. Sound4.Name = "Equip"
  107. Sound4.Parent = Part2
  108. Sound4.SoundId = "http://www.roblox.com/Asset?ID=97095034"
  109. Sound4.Volume = 0.80000001192093
  110. Sound5.Name = "Throw"
  111. Sound5.Parent = Part2
  112. Sound5.SoundId = "http://www.roblox.com/Asset?ID=97095069"
  113. BillboardGui6.Parent = Part2
  114. BillboardGui6.Size = UDim2.new(0, 200, 0, 50)
  115. BillboardGui6.Enabled = false
  116. BillboardGui6.AlwaysOnTop = true
  117. TextLabel7.Parent = BillboardGui6
  118. TextLabel7.Size = UDim2.new(0, 200, 0, 50)
  119. TextLabel7.Text = "You thrown the super ball of doom"
  120. TextLabel7.BackgroundColor3 = Color3.new(1, 1, 1)
  121. TextLabel7.Font = Enum.Font.SourceSans
  122. TextLabel7.FontSize = Enum.FontSize.Size14
  123. SpecialMesh8.Parent = Part2
  124. SpecialMesh8.MeshId = "rbxassetid://96501868"
  125. SpecialMesh8.Scale = Vector3.new(2, 2, 2)
  126. SpecialMesh8.TextureId = "rbxassetid://96502130"
  127. SpecialMesh8.VertexColor = Vector3.new(1, 0.375, 0.400000006)
  128. SpecialMesh8.MeshType = Enum.MeshType.FileMesh
  129. SpecialMesh8.Scale = Vector3.new(2, 2, 2)
  130. LocalScript9.Name = "MouseIcon"
  131. LocalScript9.Parent = Tool0
  132. table.insert(cors,sandbox(LocalScript9,function()
  133. local MOUSE_ICON = "rbxassetid://507449825"
  134. local RELOADING_ICON = "rbxassetid://507449806"
  135.  
  136. local Tool = script.Parent
  137. local Mouse = nil
  138.  
  139. local function UpdateIcon()
  140. if Mouse then
  141. Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
  142. end
  143. end
  144.  
  145. local function OnEquipped(mouse)
  146. Mouse = mouse
  147. UpdateIcon()
  148. end
  149.  
  150. local function OnChanged(property)
  151. if property == 'Enabled' then
  152. UpdateIcon()
  153. end
  154. end
  155.  
  156. Tool.Equipped:connect(OnEquipped)
  157. Tool.Changed:connect(OnChanged)
  158. end))
  159. LocalScript10.Parent = Tool0
  160. table.insert(cors,sandbox(LocalScript10,function()
  161. local Tool = script.Parent
  162. local Ball = Tool.Handle
  163. local Player = game.Players.LocalPlayer
  164. local Mouse = Player:GetMouse()
  165. function fire(direction)
  166. Tool.Handle.Throw:Play()
  167. local vCharacter = Tool.Parent
  168. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  169. local missile = Instance.new("Part")
  170. local spawnPos = vCharacter.PrimaryPart.Position
  171. spawnPos = spawnPos + (direction * 5)
  172. missile.Material = "Granite"
  173. missile.Position = spawnPos
  174. missile.BrickColor = BrickColor.Random()
  175. missile.Size = Vector3.new(2,2,2)
  176. missile.Velocity = direction * 200
  177. missile.Shape = 0
  178. missile.CustomPhysicalProperties = PhysicalProperties.new(.6 ,.5, 1, 1, 1.75)
  179. missile.Name = "Dodgeball"
  180. missile.Elasticity = 1
  181. missile.Friction = .5
  182. local NewColor = BrickColor.random().Color
  183.  
  184. Tool.Handle.Boing:clone().Parent = missile
  185. local new_script = script.Parent.CannonBall:clone()
  186. new_script.Disabled = false
  187. new_script.Parent = missile
  188. local creator_tag = Instance.new("ObjectValue")
  189. creator_tag.Value = vPlayer
  190. creator_tag.Name = "creator"
  191. creator_tag.Parent = missile
  192. missile.Parent = game.Workspace
  193. end
  194.  
  195. enable = false
  196. i = 12
  197. function Shoot(key)
  198.  
  199.  
  200. if key == "q" then
  201.  
  202. local character = Tool.Parent;
  203. local humanoid = character.Humanoid
  204. if humanoid == nil then
  205. print("Humanoid not found")
  206. return
  207. end
  208. local targetPos = humanoid.TargetPoint
  209. local lookAt = (targetPos - character.Head.Position).unit
  210. Tool.Handle.Transparency = 1
  211. for n = 1,i do
  212. wait()
  213. fire(lookAt)
  214. end
  215.  
  216.  
  217. wait(2)
  218. Tool.Handle.Transparency = 0
  219.  
  220.  
  221. while enable do
  222. wait()
  223. i = i + 1 * i
  224.  
  225. if i < 80 then
  226. i = 0
  227. end
  228.  
  229. end
  230. end
  231. end
  232.  
  233.  
  234. Mouse.KeyDown:connect(Shoot)
  235. Mouse.KeyUp:connect(function()
  236. enabled = true
  237.  
  238. end)
  239.  
  240.  
  241. end))
  242. for i,v in pairs(mas:GetChildren()) do
  243. v.Parent = game:GetService("Players").LocalPlayer.Character
  244. pcall(function() v:MakeJoints() end)
  245. end
  246. mas:Destroy()
  247. for i,v in pairs(cors) do
  248. spawn(function()
  249. pcall(v)
  250. end)
  251. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement