Advertisement
RyanDaCoder

Unremovable Path Giver

Jul 27th, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. local hopperbin = Instance.new("HopperBin")
  2. hopperbin.Name = "Rainbow Path"
  3. hopperbin.Parent = game.Players.LocalPlayer.Backpack
  4.  
  5. bin = script.Parent
  6. function onKeyDown(key,mouse)
  7. key:lower()
  8. if key == "r" then
  9. e = game.Workspace:GetChildren()
  10. for i=1,#e do
  11. if e[i].className == "Part" then
  12. if e[i].Name == "Ice" then
  13. if e[i]:findFirstChild("creator")~=nil then
  14. if e[i].creator.Value == script.Parent.Parent.Parent then
  15. e[i]:remove()
  16. end
  17. end
  18. end
  19. end
  20. end
  21. elseif key == "n" then
  22. e = game.Workspace:GetChildren()
  23. for i=1,#e do
  24. if e[i].className == "Part" then
  25. if e[i].Name == "Ice" then
  26. e[i]:remove()
  27. end
  28. end
  29. end
  30.  
  31. end
  32. end
  33.  
  34. function press(mouse)
  35. if sel == true then
  36. hit = mouse.Target
  37. local point = mouse.Hit.p
  38. s = Instance.new("Part")
  39. s.CanCollide = true
  40. s.Size=Vector3.new(6,2,18)
  41. s.Anchored = true
  42. s.Color = Color3.new(math.random(),math.random(),math.random())
  43. s.Transparency = 0.3
  44. s.Name = "Ice"
  45. s.TopSurface = "Smooth"
  46. s.BottomSurface = "Smooth"
  47. s.Parent = game.Workspace
  48. c = script.CleanUp:clone()
  49. c.Disabled = false
  50. c.Parent = s
  51. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
  52. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-4,script.Parent.Parent.Parent.Character.Torso.Position.z)
  53. s.CFrame = CFrame.new(s.Position,point)
  54. r = Instance.new("ObjectValue")
  55. r.Value = script.Parent.Parent.Parent
  56. r.Parent = s
  57. r.Name = "creator"
  58. wait()
  59. press(mouse)
  60. end
  61. end
  62.  
  63.  
  64. function onButton1Down(mouse)
  65. sel = true
  66. if sel == true then
  67. hit = mouse.Target
  68. local point = mouse.Hit.p
  69. s = Instance.new("Part")
  70. s.CanCollide = true
  71. s.Size=Vector3.new(5,2,17)
  72. s.Anchored = true
  73. s.Color = Color3.new(math.random(),math.random(),math.random())
  74. s.Transparency = 0.3
  75. s.Name = "Ice"
  76. s.TopSurface = "Smooth"
  77. s.BottomSurface = "Smooth"
  78. s.Parent = game.Workspace
  79. c = script.CleanUp:clone()
  80. c.Disabled = false
  81. c.Parent = s
  82. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
  83. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-5,script.Parent.Parent.Parent.Character.Torso.Position.z)
  84. s.CFrame = CFrame.new(s.Position,point)
  85. r = Instance.new("ObjectValue")
  86. r.Value = script.Parent.Parent.Parent
  87. r.Parent = s
  88. r.Name = "creator"
  89. wait()
  90. hit = mouse.Target
  91. local point = mouse.Hit.p
  92. s = Instance.new("Part")
  93. s.CanCollide = true
  94. s.Size=Vector3.new(5,2,17)
  95. s.Anchored = true
  96. s.Color = Color3.new(math.random(),math.random(),math.random())
  97. s.Transparency = 0.3
  98. s.Name = "Ice"
  99. s.TopSurface = "Smooth"
  100. s.BottomSurface = "Smooth"
  101. s.Parent = game.Workspace
  102. c = script.CleanUp:clone()
  103. c.Disabled = false
  104. c.Parent = s
  105. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
  106. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-4,script.Parent.Parent.Parent.Character.Torso.Position.z)
  107. s.CFrame = CFrame.new(s.Position,point)
  108. r = Instance.new("ObjectValue")
  109. r.Value = script.Parent.Parent.Parent
  110. r.Parent = s
  111. r.Name = "creator"
  112. wait()
  113. hit = mouse.Target
  114. local point = mouse.Hit.p
  115. s = Instance.new("Part")
  116. s.CanCollide = true
  117. s.Size=Vector3.new(5,2,15)
  118. s.Anchored = true
  119. s.Color = Color3.new(math.random(),math.random(),math.random())
  120. s.Transparency = 0.3
  121. s.Name = "Ice"
  122. s.TopSurface = "Smooth"
  123. s.BottomSurface = "Smooth"
  124. s.Parent = game.Workspace
  125. c = script.CleanUp:clone()
  126. c.Disabled = false
  127. c.Parent = s
  128. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
  129. s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-6,script.Parent.Parent.Parent.Character.Torso.Position.z)
  130. s.CFrame = CFrame.new(s.Position,point)
  131. r = Instance.new("ObjectValue")
  132. r.Value = script.Parent.Parent.Parent
  133. r.Parent = s
  134. r.Name = "creator"
  135. press(mouse)
  136. end
  137. end
  138.  
  139.  
  140. function onButton1Up(mouse)
  141. sel = false
  142. end
  143.  
  144. function onEquippedLocal(mouse)
  145.  
  146. if mouse == nil then
  147. print("Mouse not found")
  148. return
  149. end
  150.  
  151. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  152. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  153. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  154. mouse.KeyDown:connect(onKeyDown)
  155. e = script.Parent.Parent.Parent:GetChildren()
  156. for i=1,#e do
  157. if e[i].className == "Hint" then
  158. e[i]:remove()
  159. end
  160. end
  161. s = Instance.new("Hint")
  162. s.Parent = script.Parent.Parent.Parent
  163. s.Text = "Hold your mouse button down to create a Rainbow Path in front of you. Press r to erase it all. Made by tbradm."
  164. end
  165.  
  166. function unsel(mouse)
  167. e = script.Parent.Parent.Parent:GetChildren()
  168. for i=1,#e do
  169. if e[i].className == "Hint" then
  170. e[i]:remove()
  171. end
  172. end
  173. end
  174.  
  175.  
  176. hopperbin.Selected:connect(onEquippedLocal)
  177. hopperbin.Deselected:connect(unsel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement