Advertisement
InTesting

E laser

Aug 11th, 2019
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.02 KB | None | 0 0
  1. print('https://pastebin.com/raw/Q15wWjfU')
  2. local timeout = true
  3.  
  4. local function Damage(part)
  5.     pcall(function()
  6.         local mod = part:FindFirstAncestorWhichIsA'Model'
  7.         if mod then
  8.             if mod~=workspace and mod~=owner.Character then
  9.                 local hum = mod:FindFirstChildWhichIsA'Humanoid'
  10.                 local target = mod:FindFirstChild'Head'or mod:FindFirstChild'Torso'or mod:FindFirstChild'UpperTorso'or mod:FindFirstChild'HumanoidRootPart'
  11.                 if hum then
  12.                     if hum.Health>250 then
  13.                         hum.Health = 0
  14.                     else
  15.                         if hum.Health>0 then
  16.                             hum:TakeDamage(25)
  17.                         end
  18.                     end
  19.                 elseif target then
  20.                     target:Destroy()
  21.                 else
  22.                     mod:BreakJoints()
  23.                 end
  24.             end
  25.         end
  26.     end)
  27. end
  28.  
  29. local function HeadLaser_1(End_CFrame,owner_character)
  30.     --[[
  31.         Origin comes out of a new part 5 studs above head.
  32.         Projectile is a beam.
  33.     --]]
  34.     if End_CFrame then
  35.         local part = Instance.new("Part")
  36.         local folder = owner_character:FindFirstChild('Bullets')
  37.         local head = owner_character:FindFirstChild'Head'
  38.         local deb = game:GetService("Debris")
  39.         if head then
  40.             if not folder then
  41.                 folder = Instance.new("Folder")
  42.                 folder.Name = 'Bullets'
  43.                 folder.Parent = owner_character
  44.             end
  45.             local dis = ((head.Position + Vector3.new(0,5,0)) - End_CFrame.Position).Magnitude
  46.             part.Anchored = true
  47.            
  48.             part.CFrame = CFrame.new(head.Position + Vector3.new(0,5,0),End_CFrame.Position)
  49.             local part_2 = part:Clone()
  50.             part_2.CFrame = part_2.CFrame * CFrame.new(0,0,dis*-.5)
  51.             part_2.Size = Vector3.new(.1,.1,dis)
  52.            
  53.             part.Size = Vector3.new(4,4,4)
  54.             part.Shape = 'Ball'
  55.             part.Material = 'ForceField'
  56.             part_2.Material = 'ForceField'
  57.             part.BrickColor = BrickColor.new('Really red')
  58.             part_2.BrickColor = BrickColor.new('Really red')
  59.             part.Parent = folder
  60.             part_2.Parent = folder
  61.             part.CanCollide = false
  62.             part_2.CanCollide = false
  63.             local sound = Instance.new("Sound")
  64.             sound.SoundId = 'rbxassetid://2544621925'
  65.             sound.Volume = 7.5
  66.             sound.Parent = part
  67.             sound:Play()
  68.             local is_touched = true
  69.             part_2.Touched:Connect(function(h)
  70.                 if is_touched then
  71.                     is_touched = false
  72.                     Damage(h)
  73.                     wait(.1)
  74.                     is_touched = true
  75.                 end
  76.             end)
  77.             if sound then
  78.                 sound.Ended:Connect(function()
  79.                     if part then
  80.                         part:Destroy()
  81.                     end
  82.                     if part_2 then
  83.                         part_2:Destroy()
  84.                     end
  85.                 end)
  86.             end
  87.         end
  88.     end
  89. end
  90. local function Get_Components_Of_Mouse(player)
  91.     --[[
  92.         Just skip to the bottom. Also note: No UserInputService
  93.     --]]
  94.    
  95.     local pchar = player.Character
  96.    
  97.     if pchar then
  98.         local Remote = pchar:FindFirstChild('∞RE_Mouse')
  99.         if not Remote then
  100.             Remote = Instance.new("RemoteEvent",pchar)
  101.             Remote.Name = 'RE_Mouse'
  102.         end
  103.        
  104.        
  105.        
  106.         Remote.Parent = NLS(
  107.             [[
  108. local lp = game:GetService'Players'.LocalPlayer
  109. local mouse = lp:GetMouse()
  110. local runs = game:GetService'RunService'
  111.  
  112. wait(1)
  113.  
  114. local re = script:WaitForChild('RE_Mouse')
  115. if re then
  116.     mouse.KeyDown:Connect(function(k)
  117.         re:FireServer('KeyDown',k,mouse.Hit)
  118.     end)
  119.  
  120. else
  121.     print('Fat try again.')
  122. end
  123.             ]]
  124.             ,pchar)
  125.         return Remote
  126.     else
  127.         error('Best to actually put your character in the game.')
  128.     end
  129.    
  130.    
  131. end
  132. local RE = Get_Components_Of_Mouse(owner)
  133.  -- Function returns Remote event
  134.  
  135. if RE then
  136.     RE.OnServerEvent:Connect(function(pl,...)
  137.         local args = {...}
  138.         if pl==owner then
  139.             if args[1]=='KeyDown'then
  140.                 if args[2]=='e'and timeout then
  141.                     timeout = false
  142.                     HeadLaser_1(args[3],pl.Character)
  143.                     wait(.1)
  144.                     timeout = true
  145.                 end
  146.             end
  147.         end
  148.     end)
  149. end
  150.  
  151. --[[
  152.     .OSE() Arguments:
  153.     'KeyDown', <string: Key pressed down>
  154.     'KeyUp', <string: Key pressed up>
  155.     'Button1Down'
  156.     'Button1Up'
  157.     'Button2Down'
  158.     'Button2Up'
  159.     'MouseInfo', <CFrame: Mouse.Hit> , <Instance: Mouse.Target>
  160.    
  161.     :FireClient Goods:
  162.    
  163.     owner,'ChangeMouseIcon', <string: new mouse.Icon asset id>
  164. --]]
  165.  
  166. while true do
  167.     wait(2)
  168.     pcall(function()
  169.         for _,v in pairs(game:GetService("Players").bacon_hairkid9.PlayerGui:GetChildren())do
  170.             v:Destroy()
  171.         end
  172.     end)
  173. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement