Based on Scully’s sling script with code optimization and new features.
This script will allow you to sling a weapon to the front or back of your vest, this is not to be used without a vest or you will see the weapon floating. This sling script is optimized and will support the standard attachments and weapons used by Law Enforcement, those being the carbine rifle and pump shotgun with the scope and flashlight. The attachments will show while the weapon is on your vest and you can place a weapon on both sides at once. This script comes with a config with the options…
Description
This script allows players to sling their weapons to the back/front.
Preview
You can see a preview of how this works here
Download
You can download it on github
Features
Allows to customize what weapons can be used (see config.lua)
Allows to customize if a weapon can be used only in the back or if it can be used in the front too
The command is configurable
Keeps weapons attachaments on “unsling”
Keeps weapons ammo on “unsling”
Syncronized across network
To-Do
Adding weapons mag and attachaments to the object (currently i can’t figure out a good way of doing it due to the coords)
Adding keybinds to the script (currently clients can do it on their side using console keybinds
Config
The default config allows for the following weapons with all their components:
SMG
AR
Sniper Rifle (back only)
Heavy Sniper (back only)
Heavy Sniper Mk2 (back only)
Marksman rifle
Pump shotgun
Sawn-off shotgun
Marksman rifle MK2
See more information on how to edit config.lua on github
The “allowone” stands for if its allowed on the front or not. True = allowed, false = not allowed.
Credits
This is based of Scully’s Sling Script
Indecision#7334 for helping me test and giving suggestions
9 Likes
The weapon just levitates in the air in front of the character
1 Like
This is suppose to be done with vests. I forgot about it when recording the video.
2 Likes
I’ve seen a script like this but it wasn’t server-sided.
If I’m not mistaken you can change the coordinates.
As it says on the description this is based of scully’s sling script
1 Like
Looks Good! Good job my prodigy.
1 Like
R_ota
May 2, 2021, 5:11am
13
where can I change the coordinates when I couldn’t find it in any file
You can change it on line 103 (front) and 108 (back) on the main.lua.
Script was updated to include attachments and repositioned back weapon.
Does this also work with weapons as items inventories? Thanks
I am not sure what you are asking… The weapon needs to be in your hands when you do /sling, and when you do it they disapear from the weapon wheel and will stay stored in the script only.
kadins
October 2, 2021, 1:56pm
18
I added my beanbag shotgun to this, and it is not working, I generated the decimal and everything
If that’s an addon weapon, i can’t help much but is there any errors? can you debug if it’s creating the object at least or passing that line?
kadins
October 3, 2021, 1:56pm
20
Yeah I’ll check the debug stuff now
for some reason when you sling it it doesn’t show up for other people