0% found this document useful (0 votes)
7 views15 pages

Guns

The document contains several scripts for a gun system in a game, detailing functionalities such as ammo management, damage infliction, and bullet visualization. It includes server and client-side scripts that handle firing mechanics, animations, and visual effects for bullets. Key features include dual-wielding support, customizable animations, and the ability to visualize bullet paths and impacts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views15 pages

Guns

The document contains several scripts for a gun system in a game, detailing functionalities such as ammo management, damage infliction, and bullet visualization. It includes server and client-side scripts that handle firing mechanics, animations, and visual effects for bullets. Key features include dual-wielding support, customizable animations, and the ability to visualize bullet paths and impacts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 15

mira te pasare los scripts que hicimos antes para que te guies pero, ns si te

acuerdes que el rifle no hacia daño en el torso

script 1(normal) .- Gunscript


local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local Player
local Character
local Humanoid
--local TEAM
local VisualizeBullet = script.Parent:WaitForChild("VisualizeBullet")
local Module = require(Tool:WaitForChild("Setting"))
local ChangeAmmoAndClip = script:WaitForChild("ChangeAmmoAndClip")
local InflictTarget = script:WaitForChild("InflictTarget")
local Grip2
local Handle2

if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",1)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is
enabled but \"Handle2\" is missing!") end
end

local AmmoValue = script:FindFirstChild("Ammo") or


Instance.new("NumberValue",script)
AmmoValue.Name = "Ammo"
AmmoValue.Value = Module.AmmoPerClip
local ClipsValue = script:FindFirstChild("Clips") or
Instance.new("NumberValue",script)
ClipsValue.Name = "Clips"
ClipsValue.Value = Module.LimitedClipEnabled and Module.Clips or 0

if Module.IdleAnimationID ~= nil or Module.DualEnabled then


local IdleAnim = Instance.new("Animation",Tool)
IdleAnim.Name = "IdleAnim"
IdleAnim.AnimationId = "rbxassetid://"..(Module.DualEnabled and 53610688 or
Module.IdleAnimationID)
end
if Module.FireAnimationID ~= nil then
local FireAnim = Instance.new("Animation",Tool)
FireAnim.Name = "FireAnim"
FireAnim.AnimationId = "rbxassetid://"..Module.FireAnimationID
end
if Module.ReloadAnimationID ~= nil then
local ReloadAnim = Instance.new("Animation",Tool)
ReloadAnim.Name = "ReloadAnim"
ReloadAnim.AnimationId = "rbxassetid://"..Module.ReloadAnimationID
end
if Module.ShotgunClipinAnimationID ~= nil then
local ShotgunClipinAnim = Instance.new("Animation",Tool)
ShotgunClipinAnim.Name = "ShotgunClipinAnim"
ShotgunClipinAnim.AnimationId =
"rbxassetid://"..Module.ShotgunClipinAnimationID
end

ChangeAmmoAndClip.OnServerEvent:connect(function(Player,Ammo,Clips)
AmmoValue.Value = Ammo
ClipsValue.Value = Clips
end)
InflictTarget.OnServerEvent:connect(function(Player,TargetHumanoid,TargetTorso,Dama
ge,Direction,Knockback,Lifesteal,FlamingBullet)
if Player and TargetHumanoid and TargetHumanoid.Health ~= 0 and TargetTorso
then
while TargetHumanoid:FindFirstChild("creator") do
TargetHumanoid.creator:Destroy()
end
local creator = Instance.new("ObjectValue",TargetHumanoid)
creator.Name = "creator"
creator.Value = Player
game.Debris:AddItem(creator,5)
TargetHumanoid:TakeDamage(Damage)
if Knockback > 0 then
TargetTorso.Velocity = Direction * Knockback
end
if Lifesteal > 0 and Humanoid and Humanoid.Health ~= 0 then
Humanoid.Health = Humanoid.Health + (Damage*Lifesteal)
end
if FlamingBullet then
local Debuff =
TargetHumanoid.Parent:FindFirstChild("IgniteScript") or script.IgniteScript:Clone()
Debuff.creator.Value = Player
Debuff.Disabled = false
Debuff.Parent = TargetHumanoid.Parent
end
end
end)

Tool.Equipped:connect(function()
Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
--TEAM = Character:FindFirstChild("TEAM")
if Module.DualEnabled and Workspace.FilteringEnabled then
Handle2.CanCollide = false
local LeftArm = Tool.Parent:FindFirstChild("Left Arm")
local RightArm = Tool.Parent:FindFirstChild("Right Arm")
if RightArm then
local Grip = RightArm:WaitForChild("RightGrip",0.01)
if Grip then
Grip2 = Grip:Clone()
Grip2.Name = "LeftGrip"
Grip2.Part0 = LeftArm
Grip2.Part1 = Handle2
--Grip2.C1 = Grip2.C1:inverse()
Grip2.Parent = LeftArm
end
end
end
end)

Tool.Unequipped:connect(function()
if Module.DualEnabled and Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)

script 2 (normal) VisualizeBulletScript


local RE = script.Parent.VisualizeBullet
RE.OnServerEvent:connect(function(Player,Handle,MuzzleOffset,EndPos,MuzzleEffect,Hi
tEffect,HitSound,ExplosiveData,BulletData,VisualizeExplosion,VisualizeEnabled)
for _, TruePlayer in pairs(game.Players:GetPlayers()) do

RE:FireClient(TruePlayer,Player,Handle,MuzzleOffset,EndPos,MuzzleEffect,HitEffect,H
itSound,ExplosiveData,BulletData,VisualizeExplosion,VisualizeEnabled)
end
end)

script 3 bulletvisualizer (localscript)

local BE = script:WaitForChild("Visualize")
local RE = script.Parent:WaitForChild("VisualizeBullet")

function
VisualizeBullet(Player,Handle,MuzzleOffset,EndPos,MuzzleEffect,HitEffect,HitSound,E
xplosiveData,BulletData,VisualizeExplosion,VisualizeEnabled)
if Player ~= game.Players.LocalPlayer then
if Handle then
local MuzzlePos = (Handle.CFrame *
CFrame.new(MuzzleOffset.X,MuzzleOffset.Y,MuzzleOffset.Z)).p
local Distance = (MuzzlePos-EndPos).magnitude/2

local Muzzle = Instance.new("Part")


Muzzle.Name = "Bullet"
Muzzle.Size = Vector3.new(0.01,0.01,0.01)
Muzzle.Transparency = 1
Muzzle.Anchored = false
Muzzle.CanCollide = false
Muzzle.TopSurface = Enum.SurfaceType.SmoothNoOutlines
Muzzle.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Particle = MuzzleEffect:Clone()
Particle.Parent = Muzzle
local Weld = Instance.new("Weld",Muzzle)
Weld.Part0 = Handle
Weld.Part1 = Muzzle
Weld.C0 =
CFrame.new(MuzzleOffset.X,MuzzleOffset.Y,MuzzleOffset.Z)
Muzzle.Position = MuzzlePos
Muzzle.Parent = Workspace.CurrentCamera
Spawn(function() Particle:Emit(5) end)
game.Debris:AddItem(Muzzle,10)

local HitPart = Instance.new("Part")


HitPart.Name = "Bullet"
HitPart.Size = Vector3.new(0.01,0.01,0.01)
HitPart.Transparency = 1
HitPart.Anchored = true
HitPart.CanCollide = false
HitPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Particle = HitEffect:Clone()
Particle.Parent = HitPart
local Sound = Instance.new("Sound",HitPart)
Sound.SoundId = "rbxassetid://"..HitSound
Sound.Volume = 1
HitPart.Position = EndPos
HitPart.Parent = Workspace.CurrentCamera
Spawn(function() Particle:Emit(2) Sound:Play() end)
game.Debris:AddItem(HitPart,10)

if ExplosiveData[1] and VisualizeExplosion then


local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = ExplosiveData[2]
Explosion.BlastPressure = 0
Explosion.Position = EndPos
Explosion.Parent = Workspace.CurrentCamera
end
if VisualizeEnabled then
local Bullet = Instance.new("Part")
Bullet.Name = "Bullet"
Bullet.Size = Vector3.new(0.2,0.2,0.2)
Bullet.BrickColor = BulletData[3]
Bullet.Transparency = BulletData[4]
Bullet.Material = BulletData[5]
Bullet.Anchored = true
Bullet.CanCollide = false
Bullet.TopSurface = Enum.SurfaceType.SmoothNoOutlines
Bullet.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Mesh = Instance.new("SpecialMesh",Bullet)
Mesh.MeshType = Enum.MeshType.Brick
Mesh.Scale = BulletData[2] * 5
Mesh.Offset = Vector3.new(0,0,-Mesh.Scale.Z/10)
Bullet.CFrame = CFrame.new(MuzzlePos,EndPos)
Bullet.Parent = Workspace.CurrentCamera
game.Debris:AddItem(Bullet,10)
if BulletData[1] ~= math.huge then
for i = 0,Distance,BulletData[1] do
if i ~= 0 then Bullet.CFrame = Bullet.CFrame *
CFrame.new(0,0,-BulletData[1]) end
if (Bullet.Position - EndPos).magnitude <
BulletData[2].Z then
Mesh.Scale =
Vector3.new(BulletData[2].X,BulletData[2].Y,(Bullet.Position - EndPos).magnitude) *
5
Mesh.Offset = Vector3.new(0,0,-
Mesh.Scale.Z/10)
end
game:GetService("RunService").Stepped:wait()
end
else
Mesh.Scale =
Vector3.new(BulletData[2].X,BulletData[2].Y,(Bullet.Position - EndPos).magnitude) *
5
Mesh.Offset = Vector3.new(0,0,-Mesh.Scale.Z/10)
local Time =
game:GetService("RunService").Heartbeat:wait()
while Bullet.Transparency < 1 do
Bullet.Transparency = Bullet.Transparency +
(Time/BulletData[6])
Time =
game:GetService("RunService").Heartbeat:wait()
end
end
if Bullet then Bullet:Destroy() end
end
end
end
end

BE.Event:connect(VisualizeBullet)
RE.OnClientEvent:connect(VisualizeBullet)
--BE.Event:connect(function() print("Bindable Firing") end)
--RE.OnClientEvent:connect(function() print("Remote Firing") end)

dentro de ese tiene un RemoteEvent que se llama Visualize

script 4 Gunscript_local (localscript)

local Tool = script.Parent


local Handle = Tool:WaitForChild("Handle")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = Workspace.CurrentCamera
local Character = Workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
--local TEAM = Character:WaitForChild("TEAM")
local VisualizeBullet = script.Parent:WaitForChild("VisualizeBullet")
local Module = require(Tool:WaitForChild("Setting"))
local GunScript_Server = Tool:WaitForChild("GunScript_Server")
local ChangeAmmoAndClip = GunScript_Server:WaitForChild("ChangeAmmoAndClip")
local InflictTarget = GunScript_Server:WaitForChild("InflictTarget")
local AmmoValue = GunScript_Server:WaitForChild("Ammo")
local ClipsValue = GunScript_Server:WaitForChild("Clips")
local GUI = script:WaitForChild("GunGUI")
local IdleAnim
local FireAnim
local ReloadAnim
local ShotgunClipinAnim
local Grip2
local Handle2
local HandleToFire = Handle

if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",2)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is
enabled but \"Handle2\" is missing!") end
end

local Equipped = false


local Enabled = true
local Down = false
local Reloading = false
local AimDown = false
local Ammo = AmmoValue.Value
local Clips = ClipsValue.Value
local MaxClip = Module.MaxClip
local PiercedHumanoid = {}

if Module.IdleAnimationID ~= nil or Module.DualEnabled then


IdleAnim = Tool:WaitForChild("IdleAnim")
IdleAnim = Humanoid:LoadAnimation(IdleAnim)
end
if Module.FireAnimationID ~= nil then
FireAnim = Tool:WaitForChild("FireAnim")
FireAnim = Humanoid:LoadAnimation(FireAnim)
end
if Module.ReloadAnimationID ~= nil then
ReloadAnim = Tool:WaitForChild("ReloadAnim")
ReloadAnim = Humanoid:LoadAnimation(ReloadAnim)
end
if Module.ShotgunClipinAnimationID ~= nil then
ShotgunClipinAnim = Tool:WaitForChild("ShotgunClipinAnim")
ShotgunClipinAnim = Humanoid:LoadAnimation(ShotgunClipinAnim)
end

function wait(TimeToWait)
if TimeToWait ~= nil then
local TotalTime = 0
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
while TotalTime < TimeToWait do
TotalTime = TotalTime +
game:GetService("RunService").Heartbeat:wait()
end
else
game:GetService("RunService").Heartbeat:wait()
end
end

function RayCast(Start,Direction,Range,Ignore)
local Hit,EndPos =
game.Workspace:FindPartOnRay(Ray.new(Start,Direction*Range),Ignore)
if Hit then
if (Hit.Transparency > 0.75
or Hit.Name == "Handle"
or Hit.Name == "Effect"
or Hit.Name == "Bullet"
or Hit.Name == "Laser"
or string.lower(Hit.Name) == "water"
or Hit.Name == "Rail"
or Hit.Name == "Arrow"
or (Hit.Parent:FindFirstChild("Humanoid") and
Hit.Parent.Humanoid.Health == 0)
or (Hit.Parent:FindFirstChild("Humanoid") and
Hit.Parent:FindFirstChild("TEAM") and TEAM and Hit.Parent.TEAM.Value ==
TEAM.Value))
or (Hit.Parent:FindFirstChild("Humanoid") and
PiercedHumanoid[Hit.Parent.Humanoid]) then
Hit,EndPos = RayCast(EndPos+(Direction*.01),Direction,Range-
((Start-EndPos).magnitude),Ignore)
end
end
return Hit,EndPos
end

function ShakeCamera()
if Module.CameraShakingEnabled then
local Intensity = Module.Intensity/(AimDown and Module.MouseSensitive
or 1)
for i = 1, 10 do
local cam_rot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local cam_scroll = (Camera.CoordinateFrame.p -
Camera.Focus.p).magnitude
local ncf =
CFrame.new(Camera.Focus.p)*cam_rot*CFrame.fromEulerAnglesXYZ((-Intensity+
(math.random()*(Intensity*2)))/100, (-Intensity+(math.random()*(Intensity*2)))/100,
0)
Camera.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
wait()
end
end
end

function Fire(ShootingHandle)
local PierceAvailable = Module.Piercing
PiercedHumanoid = {}
if FireAnim then FireAnim:Play(nil,nil,Module.FireAnimationSpeed) end
if not ShootingHandle.FireSound.Playing or not
ShootingHandle.FireSound.Looped then ShootingHandle.FireSound:Play()
script.Parent.Model.casing:FireServer() end
local Start = (Humanoid.Torso.CFrame * CFrame.new(0,1.5,0)).p--(Handle.CFrame
* CFrame.new(Module.MuzzleOffset.X,Module.MuzzleOffset.Y,Module.MuzzleOffset.Z)).p
local Spread = Module.Spread*(AimDown and 1-Module.SpreadRedution or 1)
local Direction = (CFrame.new(Start,Mouse.Hit.p) * CFrame.Angles(math.rad(-
Spread+(math.random()*(Spread*2))),math.rad(-Spread+
(math.random()*(Spread*2))),0)).lookVector
while PierceAvailable >= 0 do
local Hit,EndPos = RayCast(Start,Direction,5000,Character)
if not Module.ExplosiveEnabled then
if Hit and Hit.Parent then
local TargetHumanoid =
Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso =
Hit.Parent:FindFirstChild("HumanoidRootPart")
--local TargetTEAM = Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and
TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value
then
InflictTarget:FireServer(TargetHumanoid,
TargetTorso,
(Hit.Name ==
"Head" and Module.HeadshotEnabled) and Module.BaseDamage *
Module.HeadshotDamageMultiplier or Module.BaseDamage,
Direction,

Module.Knockback,

Module.Lifesteal,

Module.FlamingBullet)
PiercedHumanoid[TargetHumanoid] = true
--end
else
PierceAvailable = 0
end
end
else
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = Module.Radius
Explosion.BlastPressure = 0
Explosion.Position = EndPos
Explosion.Parent = Workspace.CurrentCamera
Explosion.Hit:connect(function(Hit)
if Hit and Hit.Parent and Hit.Name == "Torso" then
local TargetHumanoid =
Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso =
Hit.Parent:FindFirstChild("Torso")
--local TargetTEAM =
Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and
TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~=
TEAM.Value then
InflictTarget:FireServer(TargetHumanoid,

TargetTorso,

(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage *


Module.HeadshotDamageMultiplier or Module.BaseDamage,

Direction,

Module.Knockback,

Module.Lifesteal,

Module.FlamingBullet)
--end
end
end
end)
PierceAvailable = 0
end
PierceAvailable = Hit and (PierceAvailable - 1) or -1
script.Parent.BulletVisualizerScript.Visualize:Fire(nil,ShootingHandle,

Module.MuzzleOffset,

EndPos,

script.MuzzleEffect,

script.HitEffect,

Module.HitSoundIDs[math.random(1,#Module.HitSoundIDs)],

{Module.ExplosiveEnabled,Module.BlastRadius,Module.BlastPressure},

{Module.BulletSpeed,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,
Module.BulletMaterial,Module.FadeTime},

false,

PierceAvailable == -1 and Module.VisualizerEnabled or false)


script.Parent.VisualizeBullet:FireServer(ShootingHandle,

Module.MuzzleOffset,
EndPos,

script.MuzzleEffect,

script.HitEffect,

Module.HitSoundIDs[math.random(1,#Module.HitSoundIDs)],

{Module.ExplosiveEnabled,Module.BlastRadius,Module.BlastPressure},

{Module.BulletSpeed,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,
Module.BulletMaterial,Module.FadeTime},

true,

PierceAvailable == -1 and Module.VisualizerEnabled or false)


Start = EndPos + (Direction*0.01)
end
end

function Reload()
if Enabled and not Reloading and (Clips > 0 or not Module.LimitedClipEnabled)
and Ammo < Module.AmmoPerClip then
Reloading = true
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI =
game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
UpdateGUI()
if Module.ShotgunReload then
for i = 1,(Module.AmmoPerClip - Ammo) do
if ShotgunClipinAnim then
ShotgunClipinAnim:Play(nil,nil,Module.ShotgunClipinAnimationSpeed) end
Handle.ShotgunClipin:Play()
wait(Module.ShellClipinSpeed)
end
end
if ReloadAnim then ReloadAnim:Play(nil,nil,Module.ReloadAnimationSpeed)
end
Handle.ReloadSound:Play() script.Parent.Model.reload:FireServer()
wait(Module.ReloadTime)
if Module.LimitedClipEnabled then Clips = Clips - 1 end
Ammo = Module.AmmoPerClip
ChangeAmmoAndClip:FireServer(Ammo,Clips)
Reloading = false
UpdateGUI()
end
end

function UpdateGUI()
GUI.Frame.Ammo.Fill:TweenSizeAndPosition(UDim2.new(Ammo/Module.AmmoPerClip,0,1,0),
UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)

GUI.Frame.Clips.Fill:TweenSizeAndPosition(UDim2.new(Clips/Module.MaxClip,0,1,0),
UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
GUI.Frame.Ammo.Current.Text = Ammo
GUI.Frame.Ammo.Max.Text = Module.AmmoPerClip
GUI.Frame.Clips.Current.Text = Clips
GUI.Frame.Clips.Max.Text = Module.MaxClip

GUI.Frame.Ammo.Current.Visible = not Reloading


GUI.Frame.Ammo.Max.Visible = not Reloading
GUI.Frame.Ammo.Frame.Visible = not Reloading
GUI.Frame.Ammo.Reloading.Visible = Reloading

GUI.Frame.Clips.Current.Visible = not (Clips <= 0)


GUI.Frame.Clips.Max.Visible = not (Clips <= 0)
GUI.Frame.Clips.Frame.Visible = not (Clips <= 0)
GUI.Frame.Clips.NoMoreClip.Visible = (Clips <= 0)

GUI.Frame.Clips.Visible = Module.LimitedClipEnabled
GUI.Frame.Size = Module.LimitedClipEnabled and UDim2.new(0,250,0,100) or
UDim2.new(0,250,0,55)
GUI.Frame.Position = Module.LimitedClipEnabled and UDim2.new(1,-260,1,-110)or
UDim2.new(1,-260,1,-65)
end

Mouse.Button1Down:connect(function()
Down = true
local IsChargedShot = false
if Equipped and Enabled and Down and not Reloading and Ammo > 0 and
Humanoid.Health > 0 then
Enabled = false
if Module.ChargedShotEnabled then
if HandleToFire:FindFirstChild("ChargeSound") then
HandleToFire.ChargeSound:Play() end
wait(Module.ChargingTime)
IsChargedShot = true
end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindUp") then
HandleToFire.WindUp:Play() end
wait(Module.DelayBeforeFiring)
end
while Equipped and not Reloading and (Down or IsChargedShot) and Ammo >
0 and Humanoid.Health > 0 do
IsChargedShot = false
for i = 1,(Module.BurstFireEnabled and Module.BulletPerBurst or
1) do
Spawn(ShakeCamera)
for x = 1,(Module.ShotgunEnabled and Module.BulletPerShot
or 1) do
Fire(HandleToFire)
end
Ammo = Ammo - 1
ChangeAmmoAndClip:FireServer(Ammo,Clips)
UpdateGUI()
if Module.BurstFireEnabled then wait(Module.BurstRate) end
if Ammo <= 0 then break end
end
HandleToFire = (HandleToFire == Handle and Module.DualEnabled)
and Handle2 or Handle
wait(Module.FireRate)
if not Module.Auto then break end
end
if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped
then HandleToFire.FireSound:Stop() end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindDown") then
HandleToFire.WindDown:Play() end
wait(Module.DelayAfterFiring)
end
Enabled = true
if Ammo <= 0 then Reload() end
end
end)
Mouse.Button1Up:connect(function()
Down = false
end)

ChangeAmmoAndClip.OnClientEvent:connect(function(ChangedAmmo,ChangedClips)
Ammo = ChangedAmmo
Clips = ChangedClips
UpdateGUI()
end)
Tool.Equipped:connect(function(TempMouse)
Equipped = true
UpdateGUI()
if Module.AmmoPerClip ~= math.huge then GUI.Parent = Player.PlayerGui end
TempMouse.Icon = "rbxassetid://"..Module.MouseIconID
if IdleAnim then IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) end
TempMouse.KeyDown:connect(function(Key)
if string.lower(Key) == "r" then
Reload()
elseif string.lower(Key) == "e" then
if not Reloading and AimDown == false and Module.SniperEnabled
then
Workspace.CurrentCamera.FieldOfView = Module.FieldOfView
--[[local GUI =
game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") or
Tool.ZoomGui:Clone()
GUI.Parent = game.Players.LocalPlayer.PlayerGui]]
GUI.Scope.Visible = true
game.Players.LocalPlayer.CameraMode =
Enum.CameraMode.LockFirstPerson
script["Mouse Sensitivity"].Disabled = false
AimDown = true
Mouse.Icon="http://www.roblox.com/asset?id=187746799"
else
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI =
game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode =
Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
end
end)
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = false
local LeftArm = Tool.Parent:FindFirstChild("Left Arm")
local RightArm = Tool.Parent:FindFirstChild("Right Arm")
if RightArm then
local Grip = RightArm:WaitForChild("RightGrip",0.01)
if Grip then
Grip2 = Grip:Clone()
Grip2.Name = "LeftGrip"
Grip2.Part0 = LeftArm
Grip2.Part1 = Handle2
--Grip2.C1 = Grip2.C1:inverse()
Grip2.Parent = LeftArm
end
end
end
end)
Tool.Unequipped:connect(function()
Equipped = false
GUI.Parent = script
if IdleAnim then IdleAnim:Stop() end
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI =
game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)
Humanoid.Died:connect(function()
Equipped = false
GUI.Parent = script
if IdleAnim then IdleAnim:Stop() end
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI =
game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)

script 5 Setting (modulescript)

--[[ Version v1.0.7


===================================================================================
=================
Weapons and Tools Pack 2016's Gun by SuperEvilAzmil

Features:
- FilteringEnabled support
- Easy to edit with a bunch of settings
- No delays between Mouse Click and Gun Fire
===================================================================================
=================
]]

local Module = {
-- ====================
-- BASIC
-- A basic settings for the gun
-- ====================

Auto = false;
MuzzleOffset = Vector3.new(0, 0.625, 1.25);
BaseDamage = 26;
FireRate = 0.10 ; --In second
ReloadTime = 2; --In second
AmmoPerClip = 30; --Put "math.huge" to make this gun has infinite ammo
and never reload
Spread = 1.25; --In degree
HeadshotEnabled = true; --Enable the gun to do extra damage on headshot
HeadshotDamageMultiplier = 4;
MouseIconID = "316279304";
HitSoundIDs = {186809061,186809249,186809250,186809252};
IdleAnimationID = 94242777; --Set to "nil" if you don't want to animate
IdleAnimationSpeed = 1;
FireAnimationID = 94332152; --Set to "nil" if you don't want to animate
FireAnimationSpeed = 6;
ReloadAnimationID = 95384819;
ReloadAnimationSpeed = 3;

-- ====================
-- LIMITED CLIP
-- Make a gun has a limit clip
-- ====================

LimitedClipEnabled = false;
Clips = 10;
MaxClip = 10; --Put "math.huge" to allow user to carry unlimited clip

-- ====================
-- SHOTGUN
-- Enable the gun to fire multiple bullet in one shot
-- ====================

ShotgunEnabled = false;
BulletPerShot = 8;

ShotgunReload = false; --Make user reloading like Shotgun, which user


clipin shell one by one
ShotgunClipinAnimationID = nil; --Set to "nil" if you don't want to
animate
ShotgunClipinAnimationSpeed = 1;
ShellClipinSpeed = 0.5; --In second

-- How "ShotgunEnabled" work [Example]:

-- Play "ShotgunClipinAnimation" + Play "ShotgunClipin" Audio


-- >>>
-- Wait "ShellClipinSpeed" second
-- >>>
-- Repeat "AmmoPerClip" - "Current Ammo" times
-- >>>
-- Play "ReloadAnimation" + Play "ReloadSound"
-- Wait "ReloadTime"

-- ====================
-- BURST FIRE
-- Enable the gun to do burst firing like Assault Rifle
-- ====================

BurstFireEnabled = true;
BulletPerBurst = 3;
BurstRate = 0.075; --In second

-- ====================
-- SNIPER
-- Enable user to use scope
-- ====================

SniperEnabled = false;
FieldOfView = 12.5;
MouseSensitive = 0.05; --In percent
SpreadRedution = 1; --In percent.

-- ====================
-- CAMERA SHAKING
-- Make user's camera shaking when shooting
-- ====================

CameraShakingEnabled = true;
Intensity = 0.5; --In degree

-- ====================
-- EXPLOSIVE
-- Make a bullet explosive so user can deal a damage to multiple enemy in single
shot. NOTE: Explosion won't break joints
-- ====================

ExplosiveEnabled = false;
Radius = 8;

-- ====================
-- BULLET VISUALIZER
-- Enabled the gun to display a fake travelling bullet
-- ====================

VisualizerEnabled = true;
BulletSpeed = 25;
BulletSize = Vector3.new(0.25,0.25,100);
BulletColor = BrickColor.new("Bright yellow");
BulletTransparency = 0.25;
BulletMaterial = Enum.Material.SmoothPlastic;
FadeTime = 0.25; --Only work when bullet travel instantly. For this,
you have to set BulletSpeed to "math.huge"

-- ====================
-- CHARGED SHOT
-- Make a gun charging before firing. Useful for a gun like "Railgun" or "Laser
Cannon"
-- ====================

ChargedShotEnabled = false;
ChargingTime = 1;

-- ====================
-- MINIGUN
-- Make a gun delay before/after firing
-- ====================

MinigunEnabled = false;
DelayBeforeFiring = 1;
DelayAfterFiring = 1;

-- ====================
-- MISCELLANEOUS
-- Etc. settings for the gun
-- ====================

Knockback = 0; --Setting above 0 will enabling the gun to push enemy


back. NOTE: If "ExplosiveEnabled" is enabled, this setting is not work
Lifesteal = 0; --In percent - Setting above 0 will allow user to steal
enemy's health by dealing a damage to them.
FlamingBullet = false; --Enable the bullet to set enemy on fire. Its
DPS and Duration can be edited inside "IgniteScript"
DualEnabled = false; --Enable the user to hold two guns instead one. In
order to make this setting work, you must clone its Handle and name it to
"Handle2". Enabling this setting will override Idle Animation ID.
Piercing = 0; --Setting above 0 will enabling the gun to penetrate up
to XX victim(s). Cannot penetrate wall. NOTE: It doesn't work with
"ExplosiveEnabled"

-- ====================
-- END OF SETTING
-- ====================
}

return Module

despues hay otro remote event abajo llamado VisualizeBullet

You might also like