Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print'https://pastebin.com/raw/C1Qn8AeX'
- local person = owner.Character
- local deb = game:GetService("Debris")
- local head = person:WaitForChild'Head'
- local _ = person:WaitForChild'HumanoidRootPart'
- local _ = person:WaitForChild'Humanoid'
- -- // Weapons Closet \\ --
- local function Damage(part)
- --[[
- // Description \\
- This Function can damage a model with a given part. The default damage is 10,
- and can not be adjusted If its replacing an unnamed Function in an event.
- So it's best advised to change the
- local varables within the Function. If a humanoid is not found, the model will
- be killed.
- Local varables:
- (Number) Kill_At_LargeHealth
- Automatically kills player if the humanoid's health is atleast of
- this number. If the number is 0, Then it does nothing.
- (Number) Damage_humanoid
- Amount of damage towards the humanoid.
- --]]
- local Kill_At_LargeHealth = 100
- local Damage_humanoid = 10
- pcall(function()
- local mod = part:FindFirstAncestorWhichIsA'Model'
- if mod then
- if mod~=workspace then
- local hum = mod:FindFirstChildWhichIsA'Humanoid'
- local target = mod:FindFirstChild'Head'or mod:FindFirstChild'Torso'or mod:FindFirstChild'UpperTorso'or mod:FindFirstChild'HumanoidRootPart'
- if hum then
- if hum.Health>Kill_At_LargeHealth and Kill_At_LargeHealth~=0 then
- hum.Health = 0
- else
- if hum.Health>0 then
- hum:TakeDamage(Damage_humanoid)
- end
- end
- elseif target then
- target:Destroy()
- else
- mod:BreakJoints()
- end
- end
- end
- end)
- end
- local function CustomDamage(part,damage,Kill_At_Large_Health,noharm)
- --[[
- // Description \\
- Similar to Damage() except you can not use it to replace an unamed Function
- in an event, but this version has parameters.
- --> Manatory
- (Instance) Part the Function will be checking.
- (Number) Amount of damage.
- --> Optional
- (Number) Amount of health that a player needs in order to be automatically
- killed.
- Default =
- 0
- (Instance) The Instance that the Function will be ignoring.
- Default =
- nil
- --]]
- if not Kill_At_Large_Health then
- Kill_At_Large_Health = 0
- end
- pcall(function()
- local mod = part:FindFirstAncestorWhichIsA'Model'
- if mod then
- if mod~=workspace then
- local bool = true
- if noharm then
- if noharm==mod then
- bool = false
- end
- end
- if bool then
- local hum = mod:FindFirstChildWhichIsA'Humanoid'
- local target = mod:FindFirstChild'Head'or mod:FindFirstChild'Torso'or mod:FindFirstChild'UpperTorso'or mod:FindFirstChild'HumanoidRootPart'
- if hum then
- if hum.Health>100 then
- hum.Health = 0
- else
- if hum.Health>0 then
- hum:TakeDamage(damage)
- end
- end
- elseif target then
- target:Destroy()
- else
- mod:BreakJoints()
- end
- end
- end
- end
- end)
- end
- local function Laser_Beam(Start_Pos,End_Cframe,part_properties,beam_width,damage,
- delay_damage,noharm,duration)
- --[[
- // Description \\
- Returns part that will mimic a laser beam. Often Varies from the style.
- Best to keep the laser beam as a block and not a cylinder.
- Note theres alot of parameters so bare with me.
- M = Manatory
- O = Optional
- M Start_Pos (Vector3) Position where the laser is starting.
- M End_Cframe (CFrame) Needed to find the size of laser's length and the
- End point.
- O part_properties (Table) Properties of the laser. Use the format:
- Property = value
- Default =
- (A typical brick except:)
- Anchored = true,
- Parent = nil
- O beam_width (Number) The width and height of the laser.
- Default =
- .1
- O damage (Number) The amount of damage it will deal.
- Default =
- 10
- O delay_damage (Number) Delay in seconds for the laser to rest.
- Default =
- .1
- O noharm (Instance) Instance for the noharm argument in CustomDamage(). Basically
- ignores the model if the part it hits is a descendant of it.
- Default =
- nil
- O duration (Number) Amount in seconds before it disappears.
- Default =
- 1
- --]]
- local part = Instance.new("Part")
- local function Check_Parameter(parameter,default)
- if parameter then
- if typeof(parameter)==typeof(default)then
- return parameter
- else
- return default
- end
- else
- return default
- end
- end
- beam_width = Check_Parameter(beam_width,.1)
- damage = Check_Parameter(damage,10)
- delay_damage = Check_Parameter(delay_damage,.1)
- duration = Check_Parameter(duration,1)
- local diff = (Start_Pos - End_Cframe.Position).Magnitude
- for i,v in pairs(part_properties)do
- pcall(function()
- part[i] = v
- end)
- end
- part.Anchored = true
- part.CFrame = CFrame.new(Start_Pos,End_Cframe.Position) * CFrame.new(0,0,-diff/2)
- part.Size = Vector3.new(beam_width,beam_width,diff)
- local bool = true
- part.Touched:Connect(function(h)
- if bool then
- bool = false
- CustomDamage(h,damage,nil,noharm)
- wait(delay_damage)
- bool = true
- end
- end)
- if duration then
- local debris = game:GetService("Debris")
- debris:AddItem(part,duration)
- end
- return part
- end
- local function Bullet_Beam(Start_Pos,End_Cframe,part_properties,beam_width,damage,
- delay_damage,bullet_length,type_of_travel,noharm,is_spawned,for_loop_steps,
- for_loop_stud_step_forward,for_loop_stud_step_delay,tw_info)
- --[[
- // Description \\
- Fuck these parameters. I'm gonna make a simpler version some day.
- Returns a bullet. Note this can auto launch if you want to.
- M = Manatory
- O = Optional
- M Start_Pos (Vector3) Position where the bullet starts.
- M End_Cframe (CFrame) Necessary for the End Point of the bullet and the
- direction.
- O part_properties (Table) Table of properties for the bullet.
- Default =
- Most of the properties of a typical part.
- O beam_width (Number) The width and height of the bullet.
- Default =
- .1
- O damage (Number) The Damage it will deal.
- Default =
- 10
- O delay_damage (Number) The delay of the bullet's damage
- Default =
- 1
- O bullet_length (Number) The length of the bullet.
- Default =
- .25
- O type_of_travel (String) The Mode of travel:
- - 'for_loop'; This mode will look laggy and will use a for loop.
- - 'tween'; This mode will look smoother if in small servers and uses
- Tweenservice.
- - (Default) nil
- Note this will affect other parameters.
- O noharm (Instance) Parameter for CustomDamage()
- Default =
- nil
- O (type_of_travel~=nil) is_spawned (Boolean) Makes a new thread for the
- travel Function, If [type_of_travel] is not nil. In skid
- language, it will prevent the script from yielding/pause the script.
- Default =
- nil/false
- O (type_of_travel~=nil) for_loop_steps (Number)
- in type_of_travel=='for_loop', this number will be of how many times the
- bullet will phase through [for_loop_stud_step_forward] of studs.
- in type_of_travel=='tween', this number will be multiplied with
- [for_loop_stud_step_forward] to create the End point of the bullet.
- Default =
- 10
- O (type_of_travel~=nil) for_loop_stud_step_forward (Number)
- in type_of_travel=='for_loop', this number will be the amount of studs that
- it will go through per phase.
- in type_of_travel=='tween', this number will be multiplied with
- [for_loop_steps] to create the End point of the bullet.
- Default =
- 1
- O (type_of_travel=='for_loop') for_loop_stud_step_delay (Number)
- This number will be the amout in seconds the bullet will pause before it
- goes through another phase.
- Note this does not apply to (type_of_travel=='tween') because tween is
- based so that the bullet will travel to its End Position.
- (type_of_travel=='for_loop') is based so that it phases after a certiain
- amount of numbers.
- Default =
- .1
- O (type_of_travel=='tween') tw_info (TweenInfo)
- This will determine the time, and Enum.EasingStyle it will use.
- Default =
- TweenInfo.new(1,Enum.EasingStyle.Linear,
- Enum.EasingDirection.InOut,0,false,0)
- --]]
- local part = Instance.new("Part")
- local travel
- local diff = (Start_Pos - End_Cframe.Position).Magnitude
- local function Check_Parameter(parameter,default)
- if parameter then
- if typeof(parameter)==typeof(default)then
- return parameter
- else
- return default
- end
- else
- return default
- end
- end
- beam_width = Check_Parameter(beam_width,.1)
- damage = Check_Parameter(damage,10)
- delay_damage = Check_Parameter(delay_damage,.1)
- bullet_length = Check_Parameter(bullet_length,.25)
- for_loop_steps = Check_Parameter(for_loop_steps,10)
- for_loop_stud_step_forward = Check_Parameter(for_loop_stud_step_forward,1)
- for_loop_stud_step_delay = Check_Parameter(for_loop_stud_step_delay,.1)
- tw_info = Check_Parameter(tw_info,TweenInfo.new(1,Enum.EasingStyle.Linear,
- Enum.EasingDirection.InOut,0,false,0))
- for i,v in pairs(part_properties)do
- pcall(function()
- part[i] = v
- end)
- end
- part.Anchored = true
- part.CFrame = CFrame.new(Start_Pos,End_Cframe.Position)
- part.Size = Vector3.new(beam_width,beam_width,bullet_length)
- local bool = true
- part.Touched:Connect(function(h)
- if bool then
- bool = false
- CustomDamage(h,damage,nil,noharm)
- wait(delay_damage)
- bool = true
- end
- end)
- if type_of_travel=='for_loop'then
- travel = function()
- for i=1,for_loop_steps do
- part.CFrame = part.CFrame *
- CFrame.new(0,0,-for_loop_stud_step_forward)
- wait(for_loop_stud_step_delay)
- end
- part.Anchored = false
- part.CanCollide = false
- end
- elseif type_of_travel=='tween'then
- travel = function()
- local tws = game:GetService("TweenService")
- local prop = {
- CFrame = part.CFrame * CFrame.new(0,0,-(for_loop_steps * for_loop_stud_step_forward))
- }
- local an = tws:Create(part,tw_info,prop)
- an:Play()
- wait(an.TweenInfo.Time)
- part.Anchored = false
- part.CanCollide = false
- end
- end
- if travel then
- if is_spawned then
- spawn(travel)
- else
- travel()
- end
- end
- return part
- end
- local function On_OnServerEvent(player,...)
- local parameters = {...}
- if parameters[1]=='KeyDown'then
- if parameters[2]=='e'then
- local fold = person:FindFirstChild'Bullets'
- if not fold then
- fold = Instance.new('Folder')
- fold.Name = 'Bullets'
- fold.Parent = person
- end
- Bullet_Beam(head.Position + Vector3.new(0,5,0),parameters[3],
- {
- Parent = workspace
- }
- ,.1,10,.1,.25,
- 'tween',person,true,100,1)
- end
- end
- end
- local function Get_Components_Of_Mouse(player)
- --[[
- Just skip to the bottom. Also note: No UserInputService
- --]]
- local pchar = player.Character
- if pchar then
- local Remote = pchar:FindFirstChild('∞RE_Mouse')
- if not Remote then
- Remote = Instance.new("RemoteEvent",pchar)
- Remote.Name = 'RE_Mouse'
- end
- Remote.Parent = NLS(
- [[
- local lp = game:GetService'Players'.LocalPlayer
- local mouse = lp:GetMouse()
- local runs = game:GetService'RunService'
- wait(1)
- local re = script:WaitForChild('RE_Mouse')
- if re then
- mouse.KeyDown:Connect(function(k)
- re:FireServer('KeyDown',k,mouse.Hit)
- end)
- mouse.KeyUp:Connect(function(k)
- re:FireServer('KeyUp',k)
- end)
- mouse.Button1Down:Connect(function()
- re:FireServer('Button1Down')
- end)
- mouse.Button1Up:Connect(function()
- re:FireServer('Button1Up')
- end)
- mouse.Button2Down:Connect(function()
- re:FireServer('Button2Down')
- end)
- mouse.Button2Up:Connect(function()
- re:FireServer('Button2Up')
- end)
- runs.Heartbeat:Connect(function()
- local mh = mouse.Hit
- local mt = mouse.Target
- if mh and mt then
- re:FireServer('MouseInfo',mh,mt)
- end
- end)
- re.OnClientEvent:Connect(function(arg1,arg2)
- if arg1=='ChangeMouseIcon'then
- mouse.Icon = arg2
- end
- end)
- else
- print('Fat try again.')
- end
- ]]
- ,pchar)
- return Remote
- else
- error('Best to actually put your character in the game.')
- end
- end
- local RE = Get_Components_Of_Mouse(owner)
- -- Function returns Remote event
- if RE then
- RE.OnServerEvent:Connect(On_OnServerEvent)
- end
- --[[
- .OSE() Arguments:
- 'KeyDown', <string: Key pressed down>
- 'KeyUp', <string: Key pressed up>
- 'Button1Down'
- 'Button1Up'
- 'Button2Down'
- 'Button2Up'
- 'MouseInfo', <CFrame: Mouse.Hit> , <Instance: Mouse.Target>
- :FireClient Goods:
- owner,'ChangeMouseIcon', <string: new mouse.Icon asset id>
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement