Advertisement
yamanohera155233

Untitled

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