Advertisement
BobMe

ShrinkLaser

Jan 30th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. function sandbox(var,func)
  2. local env = getfenv(func)
  3. local newenv = setmetatable({},{
  4. __index = function(self,k)
  5. if k=="script" then
  6. return var
  7. else
  8. return env[k]
  9. end
  10. end,
  11. })
  12. setfenv(func,newenv)
  13. return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Tool0 = Instance.new("Tool")
  18. Part1 = Instance.new("Part")
  19. Sound2 = Instance.new("Sound")
  20. Decal3 = Instance.new("Decal")
  21. Decal4 = Instance.new("Decal")
  22. Decal5 = Instance.new("Decal")
  23. Decal6 = Instance.new("Decal")
  24. Decal7 = Instance.new("Decal")
  25. Decal8 = Instance.new("Decal")
  26. Script9 = Instance.new("Script")
  27. Tool0.Name = "Lucky Block"
  28. Tool0.Parent = mas
  29. Tool0.GripPos = Vector3.new(0.5, -0.5, 0)
  30. Tool0.GripRight = Vector3.new(0.707106769, -0.707106769, -0)
  31. Tool0.GripUp = Vector3.new(0.707106769, 0.707106769, 0)
  32. Tool0.ToolTip = "Are you lucky?"
  33. Part1.Name = "Handle"
  34. Part1.Parent = Tool0
  35. Part1.BrickColor = BrickColor.new("Deep orange")
  36. Part1.Rotation = Vector3.new(-180, 0, -180)
  37. Part1.Size = Vector3.new(1, 1.20000005, 1)
  38. Part1.CFrame = CFrame.new(-166.5, 0.600000024, 178.5, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  39. Part1.Color = Color3.new(1, 0.690196, 0)
  40. Part1.Position = Vector3.new(-166.5, 0.600000024, 178.5)
  41. Part1.Orientation = Vector3.new(0, 180, 0)
  42. Part1.Color = Color3.new(1, 0.690196, 0)
  43. Sound2.Name = "MagicSound"
  44. Sound2.Parent = Part1
  45. Sound2.SoundId = "http://www.roblox.com/asset/?id=35571070"
  46. Sound2.Volume = 1
  47. Decal3.Parent = Part1
  48. Decal3.Texture = "http://www.roblox.com/asset/?id=48268686"
  49. Decal4.Parent = Part1
  50. Decal4.Texture = "http://www.roblox.com/asset/?id=48268686"
  51. Decal4.Face = Enum.NormalId.Top
  52. Decal5.Parent = Part1
  53. Decal5.Texture = "http://www.roblox.com/asset/?id=48268686"
  54. Decal5.Face = Enum.NormalId.Right
  55. Decal6.Parent = Part1
  56. Decal6.Texture = "http://www.roblox.com/asset/?id=48268686"
  57. Decal6.Face = Enum.NormalId.Back
  58. Decal7.Parent = Part1
  59. Decal7.Texture = "http://www.roblox.com/asset/?id=48268686"
  60. Decal7.Face = Enum.NormalId.Left
  61. Decal8.Parent = Part1
  62. Decal8.Texture = "http://www.roblox.com/asset/?id=48268686"
  63. Decal8.Face = Enum.NormalId.Bottom
  64. Script9.Parent = Tool0
  65. table.insert(cors,sandbox(Script9,function()
  66. local Tool = script.Parent
  67.  
  68. local gears = {336371164}
  69.  
  70.  
  71.  
  72. function onActivated()
  73. -- play sound
  74. magicSound = Tool.Handle:FindFirstChild("MagicSound")
  75. if magicSound == nil then return end
  76. magicSound:Play()
  77.  
  78. -- GOOD RANDOMIZATION CODE!!
  79. numLoops = math.random(0,math.floor(1000*time()))
  80. numLoops = numLoops - (math.floor(numLoops / 10000)*10000)
  81. for i = 1,numLoops do
  82. whichNum = math.random(1,#gears)
  83. end
  84. -- END OF GOOD RANDOMIZATION CODE!
  85.  
  86. print("Picked: ")
  87. print(whichNum)
  88. local root = game:GetService("InsertService"):LoadAsset(gears[whichNum])
  89.  
  90. local instances = root:GetChildren()
  91. if #instances == 0 then
  92. root:Remove()
  93. return
  94. end
  95.  
  96. root = root:GetChildren()
  97. if #root == 1 then
  98. root = root[1]
  99. else return end
  100. print(root)
  101. root.Parent = Tool.Parent
  102. Tool:remove()
  103. end
  104.  
  105. function onEquipped()
  106. magicSound = Tool.Handle:FindFirstChild("MagicSound")
  107. if magicSound == nil then
  108. magicSound = Instance.new("Sound")
  109. magicSound.Parent = Tool.Handle
  110. magicSound.Volume = 1
  111. magicSound.SoundId = "http://www.roblox.com/asset/?id=35571070"
  112. magicSound.Name = "MagicSound"
  113. end
  114. end
  115.  
  116. Tool.Activated:connect(onActivated)
  117. Tool.Equipped:connect(onEquipped)
  118.  
  119. end))
  120. for i,v in pairs(mas:GetChildren()) do
  121. v.Parent = workspace
  122. pcall(function() v:MakeJoints() end)
  123. end
  124. mas:Destroy()
  125. for i,v in pairs(cors) do
  126. spawn(function()
  127. pcall(v)
  128. end)
  129. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement