Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- Sound2 = Instance.new("Sound")
- Decal3 = Instance.new("Decal")
- Decal4 = Instance.new("Decal")
- Decal5 = Instance.new("Decal")
- Decal6 = Instance.new("Decal")
- Decal7 = Instance.new("Decal")
- Decal8 = Instance.new("Decal")
- Script9 = Instance.new("Script")
- Tool0.Name = "Lucky Block"
- Tool0.Parent = mas
- Tool0.GripPos = Vector3.new(0.5, -0.5, 0)
- Tool0.GripRight = Vector3.new(0.707106769, -0.707106769, -0)
- Tool0.GripUp = Vector3.new(0.707106769, 0.707106769, 0)
- Tool0.ToolTip = "Are you lucky?"
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Deep orange")
- Part1.Rotation = Vector3.new(-180, 0, -180)
- Part1.Size = Vector3.new(1, 1.20000005, 1)
- Part1.CFrame = CFrame.new(-166.5, 0.600000024, 178.5, -1, 0, 0, 0, 1, 0, 0, 0, -1)
- Part1.Color = Color3.new(1, 0.690196, 0)
- Part1.Position = Vector3.new(-166.5, 0.600000024, 178.5)
- Part1.Orientation = Vector3.new(0, 180, 0)
- Part1.Color = Color3.new(1, 0.690196, 0)
- Sound2.Name = "MagicSound"
- Sound2.Parent = Part1
- Sound2.SoundId = "http://www.roblox.com/asset/?id=35571070"
- Sound2.Volume = 1
- Decal3.Parent = Part1
- Decal3.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal4.Parent = Part1
- Decal4.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal4.Face = Enum.NormalId.Top
- Decal5.Parent = Part1
- Decal5.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal5.Face = Enum.NormalId.Right
- Decal6.Parent = Part1
- Decal6.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal6.Face = Enum.NormalId.Back
- Decal7.Parent = Part1
- Decal7.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal7.Face = Enum.NormalId.Left
- Decal8.Parent = Part1
- Decal8.Texture = "http://www.roblox.com/asset/?id=48268686"
- Decal8.Face = Enum.NormalId.Bottom
- Script9.Parent = Tool0
- table.insert(cors,sandbox(Script9,function()
- local Tool = script.Parent
- local gears = {336371164}
- function onActivated()
- -- play sound
- magicSound = Tool.Handle:FindFirstChild("MagicSound")
- if magicSound == nil then return end
- magicSound:Play()
- -- GOOD RANDOMIZATION CODE!!
- numLoops = math.random(0,math.floor(1000*time()))
- numLoops = numLoops - (math.floor(numLoops / 10000)*10000)
- for i = 1,numLoops do
- whichNum = math.random(1,#gears)
- end
- -- END OF GOOD RANDOMIZATION CODE!
- print("Picked: ")
- print(whichNum)
- local root = game:GetService("InsertService"):LoadAsset(gears[whichNum])
- local instances = root:GetChildren()
- if #instances == 0 then
- root:Remove()
- return
- end
- root = root:GetChildren()
- if #root == 1 then
- root = root[1]
- else return end
- print(root)
- root.Parent = Tool.Parent
- Tool:remove()
- end
- function onEquipped()
- magicSound = Tool.Handle:FindFirstChild("MagicSound")
- if magicSound == nil then
- magicSound = Instance.new("Sound")
- magicSound.Parent = Tool.Handle
- magicSound.Volume = 1
- magicSound.SoundId = "http://www.roblox.com/asset/?id=35571070"
- magicSound.Name = "MagicSound"
- end
- end
- Tool.Activated:connect(onActivated)
- Tool.Equipped:connect(onEquipped)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement