mjv2023

subspace tripmine script

Jul 15th, 2023
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local Equipped = false
  3. local Plr = Players.LocalPlayer
  4. local Char = Plr.Character or Plr.CharacterAdded:Wait()
  5. local Hum = Char:WaitForChild("Humanoid")
  6. local Root = Char:WaitForChild("HumanoidRootPart")
  7. local RightArm = Char:WaitForChild("RightUpperArm")
  8. local LeftArm = Char:WaitForChild("LeftUpperArm")
  9. local RightC1 = RightArm.RightShoulder.C1
  10. local LeftC1 = LeftArm.LeftShoulder.C1
  11.  
  12. local tool = Instance.new("Tool")
  13. tool.TextureId = "http://www.roblox.com/asset/?id=11987521"
  14. tool.Name = "SubspaceTripmine"
  15. tool.Parent = game.Players.LocalPlayer:WaitForChild("Backpack")
  16.  
  17. local part = Instance.new("Part")
  18. part.Name = "Handle"
  19. part.Size = Vector3.new(2, 2, 2)
  20. part.Parent = tool
  21.  
  22. local mesh = Instance.new("SpecialMesh")
  23. mesh.MeshId = "http://www.roblox.com/asset/?id=11954776"
  24. mesh.TextureId = "http://www.roblox.com/asset/?id=11954766"
  25. mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
  26. mesh.Parent = part
  27.  
  28. local function setupHands(tool)
  29. tool.Equipped:Connect(function()
  30. Equipped = true
  31. Char:SetAttribute("Hiding", true)
  32. for _, v in next, Hum:GetPlayingAnimationTracks() do
  33. v:Stop()
  34. end
  35.  
  36. RightArm.Name = "R_Arm"
  37. LeftArm.Name = "L_Arm"
  38.  
  39. RightArm.RightShoulder.C1 = RightC1
  40. * CFrame.Angles(math.rad(-90), math.rad(-10), 0)
  41. LeftArm.LeftShoulder.C1 = LeftC1
  42. * CFrame.new(-0.2, -0.2, -0.5)
  43. * CFrame.Angles(math.rad(-110), math.rad(15), math.rad(0))
  44. end)
  45.  
  46. tool.Unequipped:Connect(function()
  47. Equipped = false
  48. Char:SetAttribute("Hiding", nil)
  49. RightArm.Name = "RightUpperArm"
  50. LeftArm.Name = "LeftUpperArm"
  51.  
  52. RightArm.RightShoulder.C1 = RightC1
  53. LeftArm.LeftShoulder.C1 = LeftC1
  54. end)
  55.  
  56. tool.Activated:Connect(function()
  57. local pos = Plr:GetMouse().Hit
  58. local stclone = part:Clone()
  59. stclone.Parent = workspace
  60. stclone.Position = Plr.Character.RightHand.Position
  61. local bv = Instance.new("BodyVelocity",stclone)
  62. bv.Velocity = pos.LookVector * 50
  63. stclone.CanCollide = true
  64. task.wait(0.2)
  65. bv:Destroy()
  66. local beforeexplodesound = Instance.new("Sound")
  67. beforeexplodesound.SoundId = "rbxassetid://11956590"
  68. beforeexplodesound.Volume = 2
  69. beforeexplodesound.Parent = stclone
  70. beforeexplodesound:Play()
  71. beforeexplodesound.Ended:wait()
  72. local explodesound = Instance.new("Sound")
  73. explodesound.SoundId = "rbxassetid://11984351"
  74. explodesound.Volume = 2
  75. explodesound.Parent = stclone
  76. explodesound:Play()
  77. local nearbyParts = workspace:GetPartBoundsInBox(stclone.CFrame,Vector3.new(30,30,30))
  78. local forcetable = {}
  79. for _, part in ipairs(nearbyParts) do
  80. local check = false
  81. local partname = part.name
  82. if string.find(partname,"Wall") or string.find(partname,"Floor") then
  83. check = true
  84. end
  85. if check == false then
  86. part.Anchored = false
  87. local distance = (part.Position - stclone.Position).Magnitude
  88. local force = (15 - distance) * 100
  89. local bodyforce = Instance.new("BodyVelocity",part)
  90. bodyforce.Velocity = (force * (part.Position - stclone.Position).Unit)
  91. table.insert(forcetable,bodyforce)
  92. part.CFrame = part.CFrame * CFrame.new(math.random(1,5),0,math.random(1,5))
  93. end
  94. end
  95. wait(0.1)
  96. for i,aforce in ipairs(forcetable) do
  97. aforce:Destroy()
  98. end
  99. explodesound.Ended:Wait()
  100. stclone:Destroy()
  101. end)
  102. end
  103.  
  104. setupHands(tool)
Add Comment
Please, Sign In to add comment