Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 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. LocalScript1 = Instance.new("LocalScript")
  19. Part2 = Instance.new("Part")
  20. Tool0.Name = "DiamondPickaxe"
  21. Tool0.Parent = mas
  22. Tool0.GripForward = Vector3.new(0.707156658, 0.70705688, 7.0952141e-05)
  23. Tool0.GripPos = Vector3.new(0.5, -0.25, 0)
  24. Tool0.GripRight = Vector3.new(-4.39873147e-05, -5.63550238e-05, 1)
  25. Tool0.GripUp = Vector3.new(-0.70705688, 0.707156658, 8.75029764e-06)
  26. Tool0.ToolTip = "Используется только для добывания блоков."
  27. Tool0.CanBeDropped = false
  28. LocalScript1.Parent = Tool0
  29. table.insert(cors,sandbox(LocalScript1,function()
  30. wait(1)
  31. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  32. local createPartButton = script.Parent
  33. local requestPartEvent = ReplicatedStorage:WaitForChild("axe")
  34. local player = game.Players.LocalPlayer
  35. local cursor = player:GetMouse()
  36. local val = game.Players.LocalPlayer.Backpack.val
  37. local blocks = game.Lighting:GetChildren()
  38. local v
  39. local a = 1
  40. script.Parent.Activated:connect(function()
  41. if a == 1 then
  42. for i = 1, #blocks do
  43. if blocks[i].Name == cursor.Target.Name then
  44. v = true
  45. end
  46. end
  47. a = 0
  48. if v and cursor.Target.Name ~= "sand" and cursor.Target.ClassName == "Part" then
  49. val.Value = val.Value + 50
  50. player.PlayerGui.ScreenGui.TextBox.Text = val.Value
  51. requestPartEvent:FireServer(cursor.Target)
  52. end
  53. wait(0.1)
  54. a = 1
  55. v = false
  56. end
  57. end)
  58.  
  59. end))
  60. Part2.Name = "Handle"
  61. Part2.Parent = Tool0
  62. Part2.Material = Enum.Material.WoodPlanks
  63. Part2.BrickColor = BrickColor.new("Burnt Sienna")
  64. Part2.Size = Vector3.new(2, 2, 2)
  65. Part2.CFrame = CFrame.new(-132, 1, 106, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  66. Part2.BottomSurface = Enum.SurfaceType.Smooth
  67. Part2.TopSurface = Enum.SurfaceType.Smooth
  68. Part2.Color = Color3.new(0.415686, 0.223529, 0.0352941)
  69. Part2.Position = Vector3.new(-132, 1, 106)
  70. Part2.Color = Color3.new(0.415686, 0.223529, 0.0352941)
  71. for i,v in pairs(mas:GetChildren()) do
  72. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  73. pcall(function() v:MakeJoints() end)
  74. end
  75. mas:Destroy()
  76. for i,v in pairs(cors) do
  77. spawn(function()
  78. pcall(v)
  79. end)
  80. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement