I have made an OTS ( OVER THE SHOULDER ) Gun system recently. I have nothing to do with it so I
will put it here for free.
Features:
- Aiming
- Safety (G)
- Fully customizable
- Different sounds and particles for each material
- Reduced server lag by handling visuals in a different way
- Shoulder switching (Q, E)
How to use:
1. Changing the gun model:
To change the gun first find a new gun model. When you find it delete everything
from the GunModel except for the "FirePart" Then handle and the FirePart to
fit your new model and weld everything in GunModel to the handle including the
FirePart. Once you did that it should work.
-- GunModel is a model in the gun tool.
Note:
Dont forget to put the new model for the gun in the GunModel.
2. Changing the properties:
To change the properties open the "Settings" module in the gun.
The following are the meanings for the variables:
- Ammo: Magazine capacity
- Damage: Damage made with one bullet
- Range: How far the bullet can go in studs
- Recoil: Doesnt do anything, to change go in the client and find the recoil_amount
- Automatic: Defines if the gun will fire automatically or not
- Shotgun: Defines if the gun is a shotgun
- Pellet Amount: How many pellets will be fired, only works with shotguns
- Reload: Reload time
- Rate: The lower this is, the faster it will fire
- CasingId: The bullet casing that will drop -- 1 PISTOL -- 2 RIFLE -- 3 SHOTGUN --
3. Changing the animations:
To change the animations go to the configuration folder in the tool where you will
find the animations folder. There just change the IDs.
Note: DO NOT leave an animation ID empty. It will break the system.
4. Changing the sounds.
Simply just go to the tool handle, in it there will be sounds and just
replace the sound IDs.
5. Changing the particles:
To change the fire particles simply put new ones in the FirePart. You do not have
to rename them.
To change the hit particles you can find them in the GunSystem folder in
Replicated storage. There you can find particles, hit sounds and bullet holes.
6. Directories:
* GunSystem folder, must be in Replicated Storage.
* StarterPlayer > StarterPlayerScripts, gun visuals, must be there.
* Gun Tools, can be anywhere.
7. Disabling the OTS System:
To do this you have to replace the code in every gun client script to this code:
---------------------------------------------------------------------------------------------------------
-- WAITING TILL PLAYER IS LOADED
wait(2)
-- VARIABLES
local plr = game.Players.LocalPlayer
local mouse = game.Players.LocalPlayer:GetMouse()
local tool = script.Parent
local mousedown = false
local debounce = false
local safety = false
local rel = false
local idleAnim = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Configuration.Animations.Idle)
local reloadAnim = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Configuration.Animations.Reload)
local shootAnim = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Configuration.Animations.Shoot)
local safetyAnim = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Configuration.Animations.Safety)
local aimAnim = plr.Character:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Configuration.Animations.Aim)
local set = require(script.Parent.Settings)
local gui = script.AmmoGui:Clone()
local camera = game.Workspace.CurrentCamera
local random = Random.new()
local ts = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local ots = require(game.ReplicatedStorage.GunSystem["OTS Camera System"])
local InputS = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local random = Random.new()
local spread_amount = math.rad(5)
local recoil_amount = 0.005
local recoil_acc = CFrame.Angles(0, 0, 0)
local recoil_decay = 0.85
function shootF()
local shoot_cf = camera.CFrame * CFrame.Angles(
random:NextNumber(-recoil_amount, recoil_amount),
random:NextNumber(-recoil_amount, recoil_amount),
0
)
local shoot_ray = Ray.new(shoot_cf.p, shoot_cf.LookVector)
camera.CFrame = camera.CFrame * recoil_acc:inverse()
recoil_acc = recoil_acc * CFrame.Angles(recoil_amount, 0.01, 0)
camera.CFrame = camera.CFrame * recoil_acc
end
game:GetService("RunService").RenderStepped:Connect(function(dt)
camera.CFrame = camera.CFrame * recoil_acc:inverse()
recoil_acc = recoil_acc:Lerp(CFrame.new(), recoil_decay * dt)
camera.CFrame = camera.CFrame * recoil_acc
end)
-- EQUIP AND UNEQUIP
tool.Equipped:Connect(function()
if safety == false then
idleAnim:Play()
else
safetyAnim:Play()
end
debounce = true
script.Parent.Handle.Equip:Play()
wait(0.2)
if safety == false then
debounce = false
end
gui.Ammo.Text = script.Parent.Ammo.Value
gui.Parent = plr.PlayerGui
end)
tool.Unequipped:Connect(function()
gui.Parent = plr
shootAnim:Stop()
idleAnim:Stop()
reloadAnim:Stop()
safetyAnim:Stop()
script.Parent.Handle.Reload:Stop()
end)
tool.AncestryChanged:Connect(function()
if tool.Parent ~= plr.Character then
gui.Parent = plr
shootAnim:Stop()
idleAnim:Stop()
reloadAnim:Stop()
safetyAnim:Stop()
script.Parent.Handle.Reload:Stop()
end
end)
-- MOUSE FUNCTIONS
tool.Activated:Connect(function()
if set.automatic == false then
if debounce == false and script.Parent.Ammo.Value > 0 and safety == false then
debounce = true
script.Parent.Configuration.RemoteEvents.Fire:FireServer(mouse.Hit.p)
shootAnim:Play()
shootF()
wait(set.rate)
debounce = false
end
else
if debounce == false and script.Parent.Ammo.Value > 0 and safety == false then
mousedown = true
repeat
if plr.Character:FindFirstChild(tool.Name) and script.Parent.Ammo.Value ~= 0 and script.Parent.Ammo.Value > 0 then
script.Parent.Configuration.RemoteEvents.Fire:FireServer(mouse.Hit.p)
shootAnim:Play()
shootF()
wait(set.rate)
end
until mousedown == false or debounce == true or safety == true or script.Parent.Ammo.Value < 1 or script.Parent.Ammo.Value == 0
end
end
end)
mouse.Button1Up:Connect(function()
if mousedown == true then
mousedown = false
debounce = true
delay(set.rate, function()
debounce = false
end)
end
end)
-- AMMO GUI
script.Parent.Ammo.Changed:Connect(function()
gui.Ammo.Text = script.Parent.Ammo.Value
end)
-- KEYBINDS
uis.InputBegan:Connect(function(input, chatting)
if input.KeyCode == Enum.KeyCode.R then
if chatting == false and script.Parent.Ammo.Value < set.ammo and plr.Character:FindFirstChild(tool.Name) then
if rel == false then
rel = true
debounce = true
reloadAnim:Play()
script.Parent.Configuration.RemoteEvents.Reload:FireServer()
wait(set.reload)
if safety == false then
debounce = false
end
rel = false
end
end
elseif input.KeyCode == Enum.KeyCode.G then
if chatting == false and plr.Character:FindFirstChild(tool.Name) then
if safety == false then
debounce = true
safety = true
safetyAnim:Play()
else
debounce = false
safety = false
safetyAnim:Stop()
idleAnim:Play()
end
end
end
end)
-- KILL FEED
script.Parent.Configuration.RemoteEvents.Kill.OnClientEvent:Connect(function(plr, user)
local t = script.Template:Clone()
t.Parent = gui.KillFeed
gui.KillFeed.Sound:Play()
t.Text = "[ KILLED: "..string.upper(user).." ]"
delay(2, function()
ts:Create(t, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
ts:Create(t, TweenInfo.new(0.5), {TextStrokeTransparency = 1}):Play()
wait(0.5)
t:Destroy()
end)
end)
-- DEATH
plr.Character.Humanoid.Died:Connect(function()
ots:Disable()
ots:SetCharacterAlignment(false)
tool:Destroy()
end)
If you would like more tutorials, make a comment.
PLEASE DO NOT SELL THIS OR CLAIM IT AS YOUR OWN!!!