Advertisement
Rufus14

a taser tool

Oct 15th, 2021
2,218
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.40 KB | None | 1 1
  1. --By Rufus14
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4.     local env = getfenv(func)
  5.     local newenv = setmetatable({},{
  6.         __index = function(self,k)
  7.             if k=="script" then
  8.                 return var
  9.             else
  10.                 return env[k]
  11.             end
  12.         end,
  13.     })
  14.     setfenv(func,newenv)
  15.     return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. Sound2 = Instance.new("Sound")
  22. EqualizerSoundEffect3 = Instance.new("EqualizerSoundEffect")
  23. Beam4 = Instance.new("Beam")
  24. SpecialMesh5 = Instance.new("SpecialMesh")
  25. Script6 = Instance.new("Script")
  26. Tool0.Name = "taser"
  27. Tool0.Parent = mas
  28. Part1.Name = "Handle"
  29. Part1.Parent = Tool0
  30. Part1.CFrame = CFrame.new(-0.100037001, 7, -35, 0, -1, 6.12323426e-17, 0, 6.12323426e-17, 1, -1, 0, 0)
  31. Part1.Orientation = Vector3.new(-90, 90, 0)
  32. Part1.Position = Vector3.new(-0.10003700107336, 7, -35)
  33. Part1.Rotation = Vector3.new(-90, 0, 90)
  34. Part1.Size = Vector3.new(0.25, 0.5, 1.2999999523163)
  35. Part1.BottomSurface = Enum.SurfaceType.Smooth
  36. Part1.RotVelocity = Vector3.new(1, 1, 1)
  37. Part1.TopSurface = Enum.SurfaceType.Smooth
  38. Sound2.Name = "shoot"
  39. Sound2.Parent = Part1
  40. Sound2.SoundId = "rbxassetid://277635663"
  41. Sound2.Volume = 2
  42. EqualizerSoundEffect3.Parent = Sound2
  43. EqualizerSoundEffect3.LowGain = 10
  44. EqualizerSoundEffect3.MidGain = 2
  45. local at = Instance.new("Attachment", Part1)
  46. at.Position = Vector3.new(0, 0.2, -0.7)
  47. local a1t = Instance.new("Attachment", Part1)
  48. a1t.Position = Vector3.new(0, -0.2, -0.7)
  49. Beam4.Name = "beam"
  50. Beam4.Parent = Part1
  51. Beam4.Attachment0 = at
  52. Beam4.Attachment1 = a1t
  53. Beam4.CurveSize0 = -0.10000000149012
  54. Beam4.CurveSize1 = -0.10000000149012
  55. Beam4.Enabled = false
  56. Beam4.FaceCamera = true
  57. Beam4.LightEmission = 1
  58. Beam4.LightInfluence = 1
  59. Beam4.Segments = 20
  60. Beam4.Texture = "rbxassetid://0"
  61. Beam4.TextureMode = Enum.TextureMode.Wrap
  62. Beam4.TextureSpeed = 20
  63. Beam4.Width0 = 0.050000000745058
  64. Beam4.Width1 = 0.050000000745058
  65. SpecialMesh5.Parent = Part1
  66. SpecialMesh5.MeshId = "http://www.roblox.com/asset/?id=99866654"
  67. SpecialMesh5.Scale = Vector3.new(0.5, 0.5, 0.5)
  68. SpecialMesh5.TextureId = "http://www.roblox.com/asset/?id=99866675"
  69. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  70. Script6.Parent = Tool0
  71. table.insert(cors,sandbox(Script6,function()
  72. --By Rufus14
  73.  
  74. local runservice = game:GetService("RunService")
  75. local players = game:GetService("Players")
  76. local debris = game:GetService("Debris")
  77.  
  78. local tool = script.Parent
  79. local handle = tool.Handle
  80. local shoot = handle.shoot
  81. local beam = handle.beam
  82. local char
  83. local gdelta
  84.  
  85. local toolstate = "unequipped"
  86.  
  87. local tasefunc
  88.  
  89. local stuntime = 7
  90.  
  91. local lightbrightness = {
  92.     ["true"] = {
  93.         5
  94.     },
  95.     ["false"] = {
  96.         0
  97.     }
  98. }
  99. local tasedhums = {}
  100. local r15blacklist = {"LowerTorso", "UpperTorso"}
  101.  
  102. function seizure(who, duration)
  103.     local whoplr = players:GetPlayerFromCharacter(who)
  104.     if whoplr then
  105.         pcall(function()
  106.             local screeng = Instance.new("ScreenGui")
  107.             local frame = Instance.new("ImageLabel", screeng)
  108.             frame.Image = "rbxasset://textures/ui/TopBar/WhiteOverlayAsset.png"
  109.             frame.BackgroundTransparency = 1
  110.             frame.ImageTransparency = 0.8
  111.             frame.Size = UDim2.new(1,1,1,36)
  112.             frame.Position = UDim2.new(0,0,0,-36)
  113.             task.spawn(function()
  114.                 local starttick = tick()
  115.                 local duration = 0
  116.                 while duration < stuntime do
  117.                     frame.ImageColor3 = Color3.fromRGB()
  118.                     task.wait()
  119.                     frame.ImageColor3 = Color3.fromRGB(255,255,255)
  120.                     duration = tick() - starttick
  121.                     task.wait()
  122.                 end
  123.             end)
  124.             debris:AddItem(screeng, duration)
  125.             screeng.Parent = whoplr:FindFirstChildOfClass("PlayerGui")
  126.         end)
  127.     end
  128. end
  129.  
  130. function createrot(motor, c0, duration)
  131.     local thelimb1 = motor.Part1
  132.     local thelimb0 = motor.Part0
  133.     local rot = Instance.new("Rotate", motor.Parent)
  134.     rot.Part0 = thelimb0
  135.     rot.Part1 = thelimb1
  136.     rot.C0 = motor.C0
  137.     rot.C1 = motor.C1
  138.     if c0 then
  139.         rot.C0 = motor.C0 * c0
  140.     end
  141.     if thelimb0.Parent:FindFirstChild("UpperTorso") and not table.find(r15blacklist, thelimb1.Name) then
  142.         rot.C0 = rot.C0 * CFrame.Angles(0,math.pi/2,0)
  143.         rot.C1 = rot.C1 * CFrame.Angles(0,math.pi/2,0)
  144.     end
  145.     if thelimb1.Name == "Head" then
  146.         rot.C1 = CFrame.new(0,-thelimb1.Size.y/2,0) * CFrame.Angles(-math.pi/2,math.pi/2,0)
  147.         rot.C0 = CFrame.new(0,thelimb0.Size.y/2,0) * CFrame.Angles(0,math.pi/2,0)
  148.     end
  149.     if not thelimb1.CanCollide or thelimb1.Name == "Head" then
  150.         local colider = Instance.new("Part", motor)
  151.         colider.Transparency = 1
  152.         colider.Size = Vector3.new(thelimb1.Size.x,thelimb1.Size.y/1.5,thelimb1.Size.z)
  153.         if thelimb0.Parent:FindFirstChild("UpperTorso") then
  154.             colider.Size = Vector3.new(thelimb1.Size.x,thelimb1.Size.y/3,thelimb1.Size.z)
  155.         end
  156.         colider:BreakJoints()
  157.         debris:AddItem(colider, duration)
  158.         local cweld = Instance.new("Weld", colider)
  159.         cweld.Part0 = thelimb1
  160.         cweld.Part1 = colider
  161.         cweld.C0 = CFrame.new(0,-(thelimb1.Size.y/1.5)+(colider.Size.y/1.25),0)
  162.         if thelimb1.Name == "Head" then
  163.             cweld.C0 = CFrame.new(0,(thelimb1.Size.y/1.5)-(colider.Size.y/1.5),0)
  164.         end
  165.     end
  166.     debris:AddItem(rot, duration)
  167.     motor.Enabled = false
  168.     task.spawn(function()
  169.         task.wait(duration)
  170.         motor.Enabled = true
  171.     end)
  172. end
  173. function paralyze(motore, duration)
  174.     createrot(motore, CFrame.new(), duration)
  175. end
  176.  
  177. tool.Equipped:Connect(function()
  178.     if toolstate ~= "tasing" then
  179.         toolstate = "equipped"
  180.     end
  181.     char = tool.Parent
  182.     local tharm = char:FindFirstChild("RightHand") or char:FindFirstChild("Right Arm")
  183.     local rightgrip = tharm:WaitForChild("RightGrip")
  184.     rightgrip.C0 = rightgrip.C0 * CFrame.new(0,0,-0.5)
  185. end)
  186. tool.Unequipped:Connect(function()
  187.     if toolstate ~= "tasing" then
  188.         toolstate = "unequipped"
  189.     end
  190. end)
  191. handle.Touched:Connect(function(t)
  192.     local thum = t.Parent:FindFirstChildOfClass("Humanoid")
  193.     if toolstate == "tasing" and thum and not table.find(tasedhums, thum) and thum.Parent ~= tool.Parent then
  194.         table.insert(tasedhums, thum)
  195.         for i,v in pairs(thum.Parent:GetDescendants()) do
  196.             if v:IsA("Motor6D") then
  197.                 paralyze(v, stuntime)
  198.             end
  199.         end
  200.         local starttick = tick()
  201.         local duration = 0
  202.         seizure(thum.Parent, stuntime)
  203.         while duration < stuntime do
  204.             duration = tick() - starttick
  205.             thum.PlatformStand = true
  206.             thum.Health = thum.Health - 0.25
  207.             task.wait(0.3)
  208.             thum.PlatformStand = false
  209.             task.wait(0.1)
  210.         end
  211.         table.remove(tasedhums, table.find(tasedhums, thum))
  212.         thum.PlatformStand = false
  213.     end
  214. end)
  215. tool.Activated:Connect(function()
  216.     if toolstate ~= "tasing" then
  217.         toolstate = "tasing"
  218.         local light = Instance.new("PointLight", handle)
  219.         local ctime = 0
  220.         local duration = 5
  221.         light.Brightness = 0
  222.         shoot:Play()
  223.         tasefunc = runservice.Stepped:Connect(function(_, delta)
  224.             beam.Enabled = not beam.Enabled
  225.             light.Brightness = lightbrightness[tostring(beam.Enabled)][1]
  226.             if beam.Enabled then
  227.                 beam.CurveSize0 = math.random(-20,20)/70
  228.                 beam.CurveSize1 = math.random(-20,20)/70
  229.             end
  230.             ctime = ctime + delta
  231.             if ctime > duration then
  232.                 tasefunc:Disconnect()
  233.                 beam.Enabled = false
  234.                 light.Brightness = 0
  235.                 if tool.Parent == char then
  236.                     toolstate = "equipped"
  237.                 else
  238.                     toolstate = "unequipped"
  239.                 end
  240.             end
  241.         end)
  242.     end
  243. end)
  244. end))
  245. for i,v in pairs(mas:GetChildren()) do
  246.     v.Parent = owner:FindFirstChildOfClass("Backpack")
  247.     pcall(function() v:MakeJoints() end)
  248. end
  249. mas:Destroy()
  250. for i,v in pairs(cors) do
  251.     spawn(function()
  252.         pcall(v)
  253.     end)
  254. end
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement