Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- BlockMesh2 = Instance.new("BlockMesh")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- Sound5 = Instance.new("Sound")
- Sound6 = Instance.new("Sound")
- Part7 = Instance.new("Part")
- Configuration8 = Instance.new("Configuration")
- IntValue9 = Instance.new("IntValue")
- BoolValue10 = Instance.new("BoolValue")
- NumberValue11 = Instance.new("NumberValue")
- NumberValue12 = Instance.new("NumberValue")
- Vector3Value13 = Instance.new("Vector3Value")
- Script14 = Instance.new("Script")
- LocalScript15 = Instance.new("LocalScript")
- ScreenGui16 = Instance.new("ScreenGui")
- Frame17 = Instance.new("Frame")
- Frame18 = Instance.new("Frame")
- Frame19 = Instance.new("Frame")
- Frame20 = Instance.new("Frame")
- ImageLabel21 = Instance.new("ImageLabel")
- ScreenGui22 = Instance.new("ScreenGui")
- Frame23 = Instance.new("Frame")
- TextLabel24 = Instance.new("TextLabel")
- TextLabel25 = Instance.new("TextLabel")
- Frame26 = Instance.new("Frame")
- Frame27 = Instance.new("Frame")
- Frame28 = Instance.new("Frame")
- ImageLabel29 = Instance.new("ImageLabel")
- TextLabel30 = Instance.new("TextLabel")
- Part31 = Instance.new("Part")
- SpotLight32 = Instance.new("SpotLight")
- Part33 = Instance.new("Part")
- SpotLight34 = Instance.new("SpotLight")
- ParticleEmitter35 = Instance.new("ParticleEmitter")
- Tool36 = Instance.new("Tool")
- Part37 = Instance.new("Part")
- CylinderMesh38 = Instance.new("CylinderMesh")
- Part39 = Instance.new("Part")
- SpecialMesh40 = Instance.new("SpecialMesh")
- SpotLight41 = Instance.new("SpotLight")
- Part42 = Instance.new("Part")
- BlockMesh43 = Instance.new("BlockMesh")
- Sound44 = Instance.new("Sound")
- Sound45 = Instance.new("Sound")
- Sound46 = Instance.new("Sound")
- Sound47 = Instance.new("Sound")
- Part48 = Instance.new("Part")
- BlockMesh49 = Instance.new("BlockMesh")
- Part50 = Instance.new("Part")
- Part51 = Instance.new("Part")
- SpotLight52 = Instance.new("SpotLight")
- ParticleEmitter53 = Instance.new("ParticleEmitter")
- Configuration54 = Instance.new("Configuration")
- IntValue55 = Instance.new("IntValue")
- BoolValue56 = Instance.new("BoolValue")
- NumberValue57 = Instance.new("NumberValue")
- NumberValue58 = Instance.new("NumberValue")
- Part59 = Instance.new("Part")
- Script60 = Instance.new("Script")
- Part61 = Instance.new("Part")
- SpecialMesh62 = Instance.new("SpecialMesh")
- Vector3Value63 = Instance.new("Vector3Value")
- Script64 = Instance.new("Script")
- LocalScript65 = Instance.new("LocalScript")
- ScreenGui66 = Instance.new("ScreenGui")
- Frame67 = Instance.new("Frame")
- Frame68 = Instance.new("Frame")
- Frame69 = Instance.new("Frame")
- Frame70 = Instance.new("Frame")
- ImageLabel71 = Instance.new("ImageLabel")
- ScreenGui72 = Instance.new("ScreenGui")
- Frame73 = Instance.new("Frame")
- TextLabel74 = Instance.new("TextLabel")
- TextLabel75 = Instance.new("TextLabel")
- Frame76 = Instance.new("Frame")
- Frame77 = Instance.new("Frame")
- Frame78 = Instance.new("Frame")
- ImageLabel79 = Instance.new("ImageLabel")
- TextLabel80 = Instance.new("TextLabel")
- Tool0.Name = "Crossbow"
- Tool0.Parent = mas
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Bright yellow")
- Part1.Transparency = 1
- Part1.Rotation = Vector3.new(-0.00999999978, 21.4099998, 0)
- Part1.CanCollide = false
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(0.300000012, 0.200000003, 0.200000003)
- Part1.CFrame = CFrame.new(72.9331665, 171.982391, 255.557465, 0.930995226, 1.29800374e-05, 0.365022629, -4.6991594e-05, 1, 8.42889422e-05, -0.365022629, -9.56257572e-05, 0.930995226)
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part1.Position = Vector3.new(72.9331665, 171.982391, 255.557465)
- Part1.Orientation = Vector3.new(0, 21.4099998, 0)
- Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
- BlockMesh2.Parent = Part1
- BlockMesh2.Scale = Vector3.new(0.925926268, 0.0370371528, 0.62962985)
- BlockMesh2.Scale = Vector3.new(0.925926268, 0.0370371528, 0.62962985)
- Sound3.Name = "Fire"
- Sound3.Parent = Part1
- Sound3.Pitch = 1.2000000476837
- Sound3.SoundId = "rbxassetid://162117430"
- Sound4.Name = "EmptyMag"
- Sound4.Parent = Part1
- Sound4.Pitch = 0.80000001192093
- Sound4.SoundId = "rbxassetid://159385334"
- Sound5.Name = "Reload"
- Sound5.Parent = Part1
- Sound5.Pitch = 1.2000000476837
- Sound5.SoundId = "http://www.roblox.com/asset/?id=2697432"
- Sound6.Name = "FlashSound"
- Sound6.Parent = Part1
- Sound6.Pitch = 100
- Sound6.SoundId = "http://www.roblox.com/asset/?id=274924676"
- Part7.Name = "Flashlight"
- Part7.Parent = Tool0
- Part7.CanCollide = false
- Part7.Size = Vector3.new(0.0500000007, 0.0500000007, 0.149999976)
- Part7.CFrame = CFrame.new(72.8948975, 172.431854, 252.964951, 1, 2.16004992e-12, 0, 2.26307861e-12, 1, 1.78260962e-10, 0, 1.78260962e-10, 1)
- Part7.Position = Vector3.new(72.8948975, 172.431854, 252.964951)
- Configuration8.Name = "Conditions"
- Configuration8.Parent = Tool0
- IntValue9.Name = "Ammo"
- IntValue9.Parent = Configuration8
- IntValue9.Value = 30
- BoolValue10.Name = "CanFire"
- BoolValue10.Parent = Configuration8
- BoolValue10.Value = true
- NumberValue11.Name = "MaxRecoil"
- NumberValue11.Parent = Configuration8
- NumberValue11.Value = 100
- NumberValue12.Name = "Recoil"
- NumberValue12.Parent = Configuration8
- Vector3Value13.Name = "SurfacePos"
- Vector3Value13.Parent = Tool0
- Vector3Value13.Value = Vector3.new(2, 3, 3)
- Script14.Name = "qPerfectionWeld"
- Script14.Parent = Tool0
- table.insert(cors,sandbox(Script14,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- -- Using a syntax hack to create a nice way to Make new items.
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- LocalScript15.Name = "GunCore"
- LocalScript15.Parent = Tool0
- table.insert(cors,sandbox(LocalScript15,function()
- --[[.
- ____ _____ _ ____ _____ ____
- | _ \| ____| / \ | _ \| ____| _ \
- | |_) | _| / _ \ | |_) | _| | |_) |
- | _ <| |___ / ___ \| __/| |___| _ <
- |_| \_\_____/_/ \_\_| |_____|_| \_\
- ___ _ _ ____ _ _ ____ _____ ____ ___ _____ ____
- |_ _| \ | | _ \| | | / ___|_ _| _ \|_ _| ____/ ___|
- | || \| | | | | | | \___ \ | | | |_) || || _| \___ \
- | || |\ | |_| | |_| |___) || | | _ < | || |___ ___) |
- |___|_| \_|____/ \___/|____/ |_| |_| \_\___|_____|____/
- ]] --(Teh)
- -- In partnership by ReaperIndustries, by CrakTheRaven and Revenus/HopeofRome
- -- not really this was made by Pragmatist but i like to take credit for things too xD
- local tool, player = script.Parent, game:GetService("Players").LocalPlayer
- -- CONFIGURATION --
- WeaponName = "Crossbow"; -- Weapon Name that shows up on the GUI text.
- BulletSpread = 0.05; -- Number of studs the bullet is offset (0 = no spread).
- WeaponType = "Semi"; -- "Auto" / "Semi"
- BulletColor = BrickColor.new("Bright orange"); -- BrickColor of the bullet.
- BulletTransparency = 100 -- Transparency of the bullet.
- BulletOrigin = tool:WaitForChild("Barrel"); -- What the bullet will shoot from.
- HitDamage = 100; -- How much damage the gun does.
- ObjectMultiplier = .3; -- Have an object you want to destroy? Object must have value of "Health"
- Cursor = "rbxasset://textures\\GunCursor.png"; -- Cursor that shows when the gun is equipped.
- HitSoundId = "rbxassetid://131864673"; -- Id of the HitSound
- HitSoundVolume = .7; -- Volume of the HitSound (make 0 if you don't want players to hear)
- MaxAmmo = 4; -- Maximum ammo per clip.
- FireRate = 4; -- Time between each shot.
- MeshType = "Block"; -- What kind of bullet you want shooting out of the gun (Block/Cylinder)
- Recoil = script.Parent.Conditions.Recoil.Value -- Value that determines reticle spacing
- MaxRecoil = script.Parent.Conditions.MaxRecoil.Value -- Maximum allowance for reticle parting
- TrueRecoil = script.Parent.Conditions.Recoil -- Spahgetti Coding variable, just to shorten things later
- -- Please don't touch anything below unless you know what you're doing! Thanks :)
- local Handle = tool:WaitForChild("Handle")
- local Barrel = tool:WaitForChild("Barrel")
- local Flashlight = tool:WaitForChild("Flashlight")
- local FakeLight = tool:WaitForChild("Light")
- local Conditions = tool:WaitForChild("Conditions")
- local AmmoCount = Conditions:WaitForChild("Ammo")
- local CanFire = Conditions:WaitForChild("CanFire")
- local Teams, ReplicatedStorage, UserInputService, RunService, Debris, Create = game:GetService("Teams"), game:GetService("ReplicatedStorage"), game:GetService("UserInputService"), game:GetService("RunService"), game:GetService("Debris"), LoadLibrary("RbxUtility").Create
- local Camera, PlayerGui, Backpack = workspace.CurrentCamera, player:WaitForChild("PlayerGui"), player:WaitForChild("Backpack")
- local BulletDump = workspace:WaitForChild("BulletDump") -- Required
- local ToolReplicator = ReplicatedStorage:WaitForChild("ToolReplicator") -- Required
- local HitSound = player.Backpack:FindFirstChild("HitSound") or Create("Sound"){Name = "HitSound", Pitch = 0.8, SoundId = HitSoundId, Volume = HitSoundVolume, Parent = player.Backpack}
- local FireSound, ReloadSound, EmptyMagSound,FlashSound = Handle:FindFirstChild("Fire"), Handle:FindFirstChild("Reload"), Handle:FindFirstChild("EmptyMag"), Handle:FindFirstChild("FlashSound")
- local Equipped, Reloading, Firing, MouseDown, Holster = false, false, false, false, false
- local ArmCFrames = {
- Left = CFrame.new(-0.232401475, 0.731157064, 1.02414107, 0.103974499, 0.97441268, -0.199301302, -0.473240495, 0.22472018, 0.851790786, 0.87477237, 0.00575334439, 0.484494328),
- Right = CFrame.new(-1.00000823, -0.100011915, 0.200000018, 0.866025448, 5.32910745e-014, -0.499999881, 0.499999881, -4.37115588e-008, 0.866025448, -2.18557332e-008, -0.999999881, -3.78553544e-008)
- }
- local HolsterCFrames = {
- Left = CFrame.new(-0.586823761, 0.480985105, 0.906768203, -0.0642859489, 0.782161772, -0.619750977, -0.431978822, 0.538023889, 0.723826647, 0.899590433, 0.314251065, 0.303290009),
- Right = CFrame.new(-0.973636985, -0.650349975, 0.0138454549, 0.696540296, 0.00785090867, -0.717475176, 0.682276845, 0.302280575, 0.665676713, 0.222104996, -0.95318675, 0.205194116)
- }
- local ReloadSequence = {
- {Time = 0.4, Left = CFrame.new(-0.209011436, 0.76324892, 0.78975606, -0.282254279, 0.907642782, 0.310671985, -0.493101478, -0.415047199, 0.76458323, 0.822911561, 0.0626139268, 0.564708829), Right = CFrame.new(-0.55685395, 0.463526368, 0.53752619, 0.954750538, -0.271960884, -0.120368935, 0.071148172, -0.184115022, 0.980326295, -0.288772106, -0.944531083, -0.156434402)},
- {Time = 0.6, Left = CFrame.new(-0.325837493, 0.707264721, 0.802219033, -0.2016415, 0.961395979, 0.187239349, -0.545462966, -0.269001901, 0.79379344, 0.81351763, 0.0579295866, 0.578647852), Right = CFrame.new(-0.736077189, 0.532853663, 0.507766426, 0.942081809, -0.258100748, -0.214163035, 0.11451336, -0.35264346, 0.928724527, -0.315227658, -0.899459004, -0.302662909)},
- {Time = 0.7, Left = CFrame.new(-0.495625108, 0.81194824, 0.587404788, -0.48886016, 0.869798005, 0.0668373406, -0.435639948, -0.309788495, 0.845132411, 0.755800009, 0.384034574, 0.53036195), Right = CFrame.new(-0.833003342, 0.573787272, 0.232965112, 0.942081809, -0.216990575, -0.255728126, 0.11451336, -0.50855732, 0.85337919, -0.315227658, -0.83323729, -0.45425418)},
- {Time = 0.8, Left = CFrame.new(-0.495624006, 0.672275305, 0.883890748, -0.488860488, 0.869798422, 0.0668372884, -0.722871542, -0.446785659, 0.52710402, 0.488336921, 0.209365755, 0.847167552), Right = CFrame.new(-0.898164988, 0.582640946, -0.0121643245, 0.938896179, -0.190729454, -0.286524475, 0.103399783, -0.63769573, 0.76331681, -0.328302413, -0.74630177, -0.57900846)},
- {Time = 0.9, Left = CFrame.new(-0.373379707, 0.768625379, 0.494097263, -0.313948035, 0.946735382, -0.0716073662, -0.406596929, -0.0659107566, 0.911226451, 0.857971728, 0.315193295, 0.405632436), Right = CFrame.new(-0.932295918, 0.531932712, 0.158023566, 0.917598903, -0.210251763, -0.337352186, 0.159367502, -0.582896173, 0.796764791, -0.364162415, -0.784873366, -0.501357317)},
- {Time = 1.1, Left = CFrame.new(-0.649042845, 0.6334849, 0.524738669, -0.338284612, 0.867902994, -0.363741338, -0.509759367, 0.155902475, 0.846073508, 0.791017711, 0.47163415, 0.389682144), Right = CFrame.new(-0.787839651, 0.494286418, 0.505542278, 0.917598903, -0.280750751, -0.281409532, 0.159367502, -0.388723493, 0.907466888, -0.364162415, -0.877537966, -0.311949492)},
- {Time = 1.2, Left = CFrame.new(-0.765217423, 0.393802643, 0.583889008, -0.262994021, 0.845609963, -0.464519083, -0.55953896, 0.258544832, 0.787445486, 0.785971105, 0.467010081, 0.405155957), Right = CFrame.new(-0.965098858, 0.319458991, 0.614931285, 0.957236052, -0.105651543, -0.269326746, 0.242726684, -0.213278487, 0.946359336, -0.15742588, -0.971261859, -0.178513214)},
- {Time = 1.4, Left = CFrame.new(-0.388958633, 0.387100548, 1.23408377, 0.198175311, 0.970845222, -0.134855196, -0.738777578, 0.238368183, 0.630387425, 0.644153416, -0.0252991598, 0.764476895), Right = CFrame.new(-0.850272775, -9.7155571e-006, 0.720583975, 0.957235992, -0.209575221, -0.199442521, 0.242726728, 0.206652865, 0.947828233, -0.157425791, -0.95570457, 0.248685315)},
- {Time = 1.6, Left = CFrame.new(-0.307948738, 0.580714345, 0.879842877, 0.0535680652, 0.998491168, -0.0120923854, -0.691506028, 0.0458293781, 0.720915675, 0.720381916, -0.0302561019, 0.692917407), Right = CFrame.new(-0.942968845, 0.159364432, 0.402672172, 0.957235992, -0.155100465, -0.244219035, 0.242726728, -0.0287858695, 0.969667554, -0.157425791, -0.987478495, 0.0100925863)},
- {Time = 1.8, Left = ArmCFrames.Left, Right = ArmCFrames.Right},
- }
- local LightSequence = {
- {Time = 0.2, Left = CFrame.new(-0.209011436, 0.76324892, 0.78975606, -0.282254279, 0.907642782, 0.310671985, -0.493101478, -0.415047199, 0.76458323, 0.822911561, 0.0626139268, 0.564708829)},
- {Time = 0.4, Left = ArmCFrames.Left, Right = ArmCFrames.Right},
- }
- local CoreBullet = Create("Part"){
- Name = "Bullet";
- BrickColor = BulletColor;
- Material = Enum.Material.Neon;
- FormFactor = Enum.FormFactor.Custom;
- Size = Vector3.new(1, 1, 1);
- Transparency = 0.7;
- Anchored = true;
- CanCollide = false;
- Locked = true;
- Create(MeshType == "Block" and "BlockMesh" or MeshType == "Cylinder" and "CylinderMesh" or "BlockMesh"){
- Name = "Mesh",
- Scale = Vector3.new(0.15, 0.15, 1)
- }
- }
- local CoreBullet2 = Create("Part"){
- Name = "ShowBullet";
- BrickColor = BulletColor;
- Material = Enum.Material.SmoothPlastic;
- FormFactor = Enum.FormFactor.Custom;
- Size = Vector3.new(1, 1, 1);
- Transparency = 0.5;
- Anchored = true;
- CanCollide = false;
- Locked = true;
- Create(MeshType == "Block" and "BlockMesh" or MeshType == "Cylinder" and "CylinderMesh" or "BlockMesh"){
- Name = "Mesh",
- Scale = Vector3.new(0.1, 0.1, 1)
- }
- }
- AmmoCount.Value = MaxAmmo
- repeat wait(0.03) until player.Character
- repeat wait(0.03) until #player.Character:GetChildren() > 10
- function TweenWeld(arm, newCFrame, seconds)
- local torso = player.Character:FindFirstChild("Torso")
- local weld = arm == "Left" and torso:FindFirstChild("LeftArmWeld") or arm == "Right" and torso:FindFirstChild("RightArmWeld")
- if weld then
- local startCF, endCF = weld.C1, newCFrame
- local startPos, startRot = startCF.p, Vector3.new(startCF:toEulerAnglesXYZ())
- local endPos, endRot = endCF.p, Vector3.new(endCF:toEulerAnglesXYZ())
- local diffPos, diffRot = (endPos - startPos), (endRot - startRot)
- local new
- for i = 0, 1, 1/seconds/30 do
- if not weld or not Equipped then break end
- new = CFrame.new(startPos+diffPos * i) * CFrame.Angles(startRot.X+diffRot.X * i, startRot.Y+diffRot.Y * i, startRot.Z+diffRot.Z * i)
- weld.C1 = new
- wait()
- end
- weld.C1 = endCF
- end
- end
- function WeldArms(c1,lArm,rArm)
- local prop = c1 and "C1" or "C0"
- local char = player.Character
- local torso = char:WaitForChild("Torso")
- local lShoulder,rShoulder = torso:FindFirstChild("Left Shoulder"),torso:FindFirstChild("Right Shoulder")
- if lArm and lShoulder then
- lShoulder.Part1 = nil
- Create("Weld"){
- Name = "LeftArmWeld",
- [prop] = lArm,
- Part0 = torso,
- Part1 = char:FindFirstChild("Left Arm"),
- Parent = torso
- }
- elseif lShoulder and torso:FindFirstChild("LeftArmWeld") then
- torso["LeftArmWeld"]:Remove()
- lShoulder.Part1 = char:FindFirstChild("Left Arm")
- end
- if rArm and rShoulder then
- rShoulder.Part1 = nil
- Create("Weld"){
- Name = "RightArmWeld",
- [prop] = rArm,
- Part0 = torso,
- Part1 = char:FindFirstChild("Right Arm"),
- Parent = torso
- }
- elseif rShoulder and torso:FindFirstChild("RightArmWeld") then
- torso["RightArmWeld"]:Remove()
- rShoulder.Part1 = char:FindFirstChild("Right Arm")
- end
- end
- function PseudoArms(bool)
- if not type(bool) == "boolean" then print("not a boolean parameter") return end
- local function destroy()
- if Camera:FindFirstChild("FakeArms") then
- Camera:FindFirstChild("FakeArms"):Destroy()
- end
- end
- local function create()
- destroy()
- local ArmsModel = Create("Model"){
- Name = "FakeArms",
- Parent = Camera,
- Create("Humanoid"){Name = "_"},
- }
- local FakeShirt = player.Character:FindFirstChild("Shirt")
- if FakeShirt then FakeShirt:Clone().Parent = ArmsModel end
- local FakeLeftArm = player.Character:FindFirstChild("Left Arm"):Clone()
- FakeLeftArm.Size = Vector3.new(0.9, 2, 0.9)
- FakeLeftArm.Parent = ArmsModel
- local FakeRightArm = player.Character:FindFirstChild("Right Arm"):Clone()
- FakeRightArm.Size = Vector3.new(0.9, 2, 0.9)
- FakeRightArm.Parent = ArmsModel
- Create("Weld"){
- Parent = ArmsModel,
- Name = "FakeLeftShoulder",
- Part0 = player.Character["Left Arm"],
- Part1 = FakeLeftArm
- }
- Create("Weld"){
- Parent = ArmsModel,
- Name = "FakeRightShoulder",
- Part0 = player.Character["Right Arm"],
- Part1 = FakeRightArm
- }
- end
- if bool then
- create()
- else
- destroy()
- end
- end
- function Light(bool,rate)
- if not type(bool) == "boolean" then print("not a boolean parameter") return end
- Barrel.Flash.Rate = rate
- Barrel.Light.Enabled = bool
- end
- function GetGUI()
- local result = PlayerGui:FindFirstChild("CrusaderGui")
- if result then
- return result
- end
- end
- function UpdateGUI()
- local Gui = GetGUI()
- Gui.Weapon.WeaponName.Text = WeaponName
- Gui.Weapon.Ammo.Text = AmmoCount.Value
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- end
- function GetHumanoid(target)
- local humanoid
- humanoid = target.Parent:FindFirstChild("Humanoid")
- if not humanoid and target.Parent.Parent ~= nil then
- humanoid = target.Parent.Parent:FindFirstChild("Humanoid")
- end
- return humanoid
- end
- function IsADefender(me, victim)
- if me.TeamColor == victim.TeamColor then
- return true
- end
- return false
- end
- function DrawLaser(init, at)
- local length = (at-init).magnitude
- local origin = CFrame.new(init, at)
- local Laser1 = CoreBullet:Clone()
- Laser1.CFrame = origin * CFrame.new(0, 0, -length/2) * CFrame.Angles(math.rad(90), 0, 0)
- Laser1.Mesh.Scale = Vector3.new(Laser1.Mesh.Scale.x, length, Laser1.Mesh.Scale.x)
- Laser1.Parent = BulletDump
- Debris:AddItem(Laser1, 0.03)
- local Laser2 = CoreBullet2:Clone()
- Laser2.CFrame = origin * CFrame.new(0, 0, -length/2) * CFrame.Angles(math.rad(90), 0, 0)
- Laser2.Mesh.Scale = Vector3.new(Laser1.Mesh.Scale.x*.5, length, Laser1.Mesh.Scale.x*.5)
- Laser2.Parent = BulletDump
- Debris:AddItem(Laser2, 0.03)
- end
- function CreateRaycast(root, last, ignore)
- local direction = (last - root).unit
- local ray = Ray.new(root, direction * 999)
- local hit, at, surface = workspace:FindPartOnRayWithIgnoreList(ray, ignore)
- tool.SurfacePos.Value = surface
- if hit and hit.Name == "Ray" then
- hit, at, surface = CreateRaycast(at, direction * 999, ignore)
- end
- return hit, at, surface
- end
- function CreateEffect(position, part)
- local dot = game.ReplicatedStorage.dot:Clone()
- dot.Parent = workspace.BulletDump
- dot.CFrame = position
- if not part.Parent:FindFirstChild("Humanoid")and part.Parent:IsA("Tool") == false and part.Parent:IsA("Hat") == false then
- if part.Material == Enum.Material.Plastic or part.Material == Enum.Material.SmoothPlastic then
- ToolReplicator:FireServer("ChangePlasticEffect", dot)
- elseif part.Material == Enum.Material.Grass then --print("Grass") -- grass
- ToolReplicator:FireServer("ChangeGrassEffect", dot)
- elseif part.Material == Enum.Material.Wood then --print("Wood") -- wood
- ToolReplicator:FireServer("ChangeWoodEffect", dot)
- elseif part.Material == Enum.Material.Metal then-- print("Metal") -- metal
- ToolReplicator:FireServer("ChangeMetalEffect", dot)
- end
- elseif part.Parent:FindFirstChild("Humanoid") or part.Parent:IsA("Hat") then
- ToolReplicator:FireServer("ChangeBloodEffect",dot)
- elseif part.Parent:IsA("Tool") then
- ToolReplicator:FireServer("ChangeMetalEffect", dot)
- end
- local rel = tool.SurfacePos.Value -- Calculating the face
- if (math.abs(rel.Z) > math.abs(rel.Y) and math.abs(rel.Z) > math.abs(rel.X)) then
- if (rel.Z > 0) then
- dot.Effect.EmissionDirection = "Back"
- dot.Dust.EmissionDirection = "Back"
- else
- dot.Effect.EmissionDirection = "Front"
- dot.Dust.EmissionDirection = "Front"
- end
- elseif (math.abs(rel.Y) > math.abs(rel.Z) and math.abs(rel.Y) > math.abs(rel.X)) then
- if (rel.Y > 0) then
- dot.Effect.EmissionDirection = "Top"
- dot.Dust.EmissionDirection = "Top"
- else
- dot.Effect.EmissionDirection = "Bottom"
- dot.Dust.EmissionDirection = "Bottom"
- end
- elseif (math.abs(rel.X) > math.abs(rel.Z) and math.abs(rel.X) > math.abs(rel.Y)) then
- if (rel.X > 0) then
- dot.Effect.EmissionDirection = "Right"
- dot.Dust.EmissionDirection = "Right"
- else
- dot.Effect.EmissionDirection = "Left"
- dot.Dust.EmissionDirection = "Left"
- end
- end
- Debris:AddItem(dot, 0.3)
- end
- function FireLaser(mouse, count)
- local aimPos = mouse.hit.p
- local bulletOrigin = BulletOrigin.Position
- local distance = (bulletOrigin - aimPos).magnitude
- if Recoil < MaxRecoil then -- revenus spahgetti scripting confirmed
- Recoil = Recoil + 5
- ReticleUpdate(mouse)
- end
- for i = 1, count do
- local aimWithSpread = Vector3.new((aimPos.x)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)),(aimPos.y)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)),(aimPos.z)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)))
- local collision, collisionPos = CreateRaycast(player.Character.Head.Position, aimWithSpread, { player.Character, Camera, workspace.BulletDump, workspace.ServerScriptService})
- DrawLaser(bulletOrigin, collisionPos)
- if collision then
- CreateEffect(CFrame.new(collisionPos), collision)
- local humanoid = GetHumanoid(collision)
- if humanoid and humanoid:IsA("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name) then
- local target = game.Players:FindFirstChild(humanoid.Parent.Name)
- if target and (not IsADefender(player, target) or target.Neutral) then
- ToolReplicator:FireServer("DamageHumanoid", humanoid, HitDamage)
- -- local Gui = GetGUI()
- player.PlayerGui.MouseGUI.Hit.Visible = true
- HitSound:Play()
- delay(0.1, function() player.PlayerGui.MouseGUI.Hit.Visible = false end)
- end
- elseif collision and collision.Parent.Parent.Name == "DestroyableObjects" then
- ToolReplicator:FireServer("DamageObject", collision, HitDamage)
- elseif collision and collision.Name == "Glass" then
- ToolReplicator:FireServer("DestroyWindows",collision)
- end
- end
- end
- end
- function FireBullet(mouse)
- CanFire.Value = false
- Barrel.Light.Angle = math.random(75, 200)
- Light(true,50)
- FireLaser(mouse, 1)
- FireSound:Play()
- AmmoCount.Value = AmmoCount.Value - 1
- wait(FireRate)
- CanFire.Value = true
- end
- function ReloadAnimation()
- local Animation = ReloadSequence
- for index, keyframe in next, Animation do
- for limb, cframe in next, keyframe do
- if limb ~= "Time" then
- spawn(function()
- local prevKeyframe = Animation[index - 1]
- local waitTime = prevKeyframe and prevKeyframe.Time or 0
- wait(waitTime)
- if not Equipped then return end
- TweenWeld(limb, cframe, keyframe.Time - waitTime)
- end)
- end
- end
- end
- wait(Animation[#Animation].Time)
- end
- function LightAnimation()
- local Animation = LightSequence
- for index, keyframe in next, Animation do
- for limb, cframe in next, keyframe do
- if limb ~= "Time" then
- spawn(function()
- local prevKeyframe = Animation[index - 1]
- local waitTime = prevKeyframe and prevKeyframe.Time or 0
- wait(waitTime)
- if not Equipped then return end
- TweenWeld(limb, cframe, keyframe.Time - waitTime)
- end)
- end
- end
- end
- wait(Animation[#Animation].Time)
- end
- function Reload()
- if AmmoCount.Value == MaxAmmo then return end
- EmptyMagSound:Play()
- Reloading = true
- Light(false,0)
- ReloadSound:Play()
- local Gui = GetGUI()
- spawn(function()
- for i = 0, 0.5, 0.05 do
- wait(0)
- pcall(function()
- Gui.Weapon.Logo.ImageTransparency = i
- end)
- end
- end)
- Gui.Weapon.Ammo.Text = "REL"
- ReloadAnimation()
- spawn(function()
- for i = 0.5, 0, -0.05 do
- wait(0)
- pcall(function()
- Gui.Weapon.Logo.ImageTransparency = i
- end)
- end
- end)
- if not Reloading then return end
- AmmoCount.Value = MaxAmmo
- Reloading = false
- end
- function ForceProperWelds()
- coroutine.wrap(TweenWeld)("Left", ArmCFrames.Left, 0.1)
- coroutine.wrap(TweenWeld)("Right", ArmCFrames.Right, 0.1)
- end
- function KeyPressed(mouse, key)
- key = key:lower()
- if key == "r" and not Reloading and Equipped then
- Reload()
- elseif key == "e" and Equipped then
- LightAnimation()
- FlashSound:Play()
- Flashlight.Light.Enabled = not Flashlight.Light.Enabled
- if FakeLight.Material == Enum.Material.Neon then FakeLight.Material = Enum.Material.SmoothPlastic else
- FakeLight.Material = Enum.Material.Neon
- end
- elseif key == "f" and not Reloading and not Firing and Equipped then
- if not Holster then
- Holster = true
- coroutine.wrap(TweenWeld)("Left", HolsterCFrames.Left, 0.1)
- coroutine.wrap(TweenWeld)("Right", HolsterCFrames.Right, 0.1)
- player.Character.Humanoid.WalkSpeed = 24
- else
- Holster = false
- ForceProperWelds()
- player.Character.Humanoid.WalkSpeed = 16
- end
- elseif key == "v" and not Reloading and not Firing and Equipped then
- local Gui = GetGUI()
- LightAnimation()
- FlashSound:Play()
- if WeaponType == "Auto" then
- WeaponType = "Semi"
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- HitDamage = HitDamage + 2
- else
- WeaponType = "Auto"
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- HitDamage = HitDamage - 2
- end
- end
- end
- function InitiateFire(mouse)
- if Reloading or Firing or not MouseDown or not CanFire.Value or (player.Character.Humanoid and player.Character.Humanoid.Health <= 0) then return end
- Firing = true
- if WeaponType == "Auto" then
- while MouseDown and Equipped and AmmoCount.Value > 0 and CanFire.Value and Firing and not Reloading and (player.Character.Humanoid and player.Character.Humanoid.Health > 0) do
- FireBullet(mouse)
- end
- elseif WeaponType == "Semi" then
- if Equipped and not Reloading then
- FireBullet(mouse)
- end
- end
- if AmmoCount.Value <= 0 then
- Reload()
- end
- Firing = false
- Light(false,0)
- end
- function Mouse1Down(mouse)
- if player.Character.Humanoid.Health <= 0 or not Equipped then return end
- if not Firing and not MouseDown and not Reloading and player.Character.Humanoid.Health > 0 and CanFire.Value then
- MouseDown = true
- player.Character.Humanoid.WalkSpeed = 16
- if Holster then
- Holster = false
- ForceProperWelds()
- end
- if AmmoCount.Value <= 0 then
- Reload()
- end
- InitiateFire(mouse)
- end
- end
- function Mouse1Up(mouse)
- MouseDown = false
- Light(false,0)
- end
- function ReticleUpdate(mouse)
- MouseGUI = player.PlayerGui.MouseGUI -- mouse gui important!!!!!!
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseUp.Position = UDim2.new(0, mouse.X-2, 0, mouse.Y-30-Recoil)
- MouseGUI.MouseDown.Position = UDim2.new(0, mouse.X-2, 0, mouse.Y+5+Recoil)
- MouseGUI.MouseLeft.Position = UDim2.new(0, mouse.X-30-Recoil, 0, mouse.Y-2)
- MouseGUI.MouseRight.Position = UDim2.new(0, mouse.X+5+Recoil, 0, mouse.Y-2)
- MouseGUI.Hit.Position = UDim2.new(0, mouse.X-32, 0, mouse.Y-32)
- end
- player.Character:WaitForChild("Humanoid").Died:connect(function()
- if PlayerGui:FindFirstChild("CrusaderGui") then
- PlayerGui.CrusaderGui:Destroy()
- end
- if Camera:FindFirstChild("FakeArms") then
- Camera:FindFirstChild("FakeArms"):Destroy()
- end
- end)
- tool.Equipped:connect(function(mouse)
- local GUI = script.MouseGUI:clone()
- GUI.Parent = player.PlayerGui
- TrueRecoil.Changed:connect(function()
- ReticleUpdate()
- end)
- mouse.Icon = "http://www.roblox.com/asset/?id=35446049"
- local newCrusGui
- if script:FindFirstChild("CrusaderGui") then
- newCrusGui = script.CrusaderGui:Clone()
- newCrusGui.Parent = PlayerGui
- newCrusGui:FindFirstChild("Weapon"):TweenPosition(UDim2.new(0.8, 0,0.8, 0), "Out", "Quad", .7, true)
- end
- Equipped = true
- WeldArms("C1", ArmCFrames.Left, ArmCFrames.Right)
- mouse.Button1Down:connect(function() Mouse1Down(mouse) end)
- mouse.Button1Up:connect(function() Mouse1Up(mouse) end)
- mouse.KeyDown:connect(function(key) KeyPressed(mouse, key) end)
- mouse.Move:connect(function()
- ReticleUpdate(mouse)
- if newCrusGui then
- local mTarget = mouse.Target
- if mTarget and mTarget.Parent then
- local humanoid = GetHumanoid(mTarget)
- if humanoid and humanoid:IsA("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name) then
- local target = game.Players:FindFirstChild(humanoid.Parent.Name)
- if target and (not IsADefender(player, target) or target.Neutral) then --enemy
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.Red().Color
- elseif target and (IsADefender(player, target) and not target.Neutral) then --ally
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.Green().Color
- end
- else --neutral
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.White().Color
- end
- end
- end
- end)
- AmmoCount.Changed:connect(function()
- UpdateGUI()
- end)
- local pMouse = player:GetMouse()
- PseudoArms(true)
- UpdateGUI()
- player.Character.Humanoid.WalkSpeed = 16
- while Equipped do
- if MouseDown == false and (Recoil > 0) then
- Recoil = Recoil - 1.25
- ReticleUpdate(mouse)
- end
- wait(0.0125)
- end
- end)
- tool.Unequipped:connect(function()
- if PlayerGui:FindFirstChild("CrusaderGui") then
- PlayerGui.CrusaderGui:Destroy()
- end
- local reviscool = player.PlayerGui:GetChildren()
- for i=1, #reviscool do
- if (reviscool[i].Name == "MouseGUI") then
- reviscool[i]:remove()
- end
- end
- UserInputService.MouseIconEnabled = true
- Equipped = false
- Firing = false
- MouseDown = false
- Reloading = false
- Holster = false
- Light(false,0)
- WeldArms("")
- PseudoArms(false)
- Flashlight.Light.Enabled = false
- end)
- end))
- ScreenGui16.Name = "MouseGUI"
- ScreenGui16.Parent = LocalScript15
- Frame17.Name = "MouseDown"
- Frame17.Parent = ScreenGui16
- Frame17.Size = UDim2.new(0, 4, 0, 25)
- Frame17.Position = UDim2.new(0, 0, 0, 50)
- Frame17.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame17.BorderColor3 = Color3.new(0, 0, 0)
- Frame18.Name = "MouseLeft"
- Frame18.Parent = ScreenGui16
- Frame18.Size = UDim2.new(0, 25, 0, 4)
- Frame18.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame18.BorderColor3 = Color3.new(0, 0, 0)
- Frame19.Name = "MouseRight"
- Frame19.Parent = ScreenGui16
- Frame19.Size = UDim2.new(0, 25, 0, 4)
- Frame19.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame19.BorderColor3 = Color3.new(0, 0, 0)
- Frame20.Name = "MouseUp"
- Frame20.Parent = ScreenGui16
- Frame20.Size = UDim2.new(0, 4, 0, 25)
- Frame20.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame20.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel21.Name = "Hit"
- ImageLabel21.Parent = ScreenGui16
- ImageLabel21.Transparency = 1
- ImageLabel21.Size = UDim2.new(0, 64, 0, 64)
- ImageLabel21.Visible = false
- ImageLabel21.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel21.BackgroundTransparency = 1
- ImageLabel21.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel21.BorderSizePixel = 0
- ImageLabel21.Image = "http://www.roblox.com/asset/?id=84799964"
- ScreenGui22.Name = "CrusaderGui"
- ScreenGui22.Parent = LocalScript15
- Frame23.Name = "Weapon"
- Frame23.Parent = ScreenGui22
- Frame23.Transparency = 1
- Frame23.Size = UDim2.new(0, 160, 0, 4)
- Frame23.Position = UDim2.new(0.800000012, 0, 2, 0)
- Frame23.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame23.BackgroundTransparency = 1
- Frame23.BorderSizePixel = 0
- TextLabel24.Name = "Ammo"
- TextLabel24.Parent = Frame23
- TextLabel24.Text = "0"
- TextLabel24.Position = UDim2.new(0, 120, 0, -2)
- TextLabel24.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel24.BorderSizePixel = 0
- TextLabel24.Font = Enum.Font.SourceSansBold
- TextLabel24.FontSize = Enum.FontSize.Size36
- TextLabel24.TextColor3 = Color3.new(1, 1, 1)
- TextLabel24.TextStrokeTransparency = 0.80000001192093
- TextLabel24.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel24.TextYAlignment = Enum.TextYAlignment.Top
- TextLabel25.Name = "WeaponName"
- TextLabel25.Parent = Frame23
- TextLabel25.Text = "WeaponName"
- TextLabel25.Position = UDim2.new(0, 4, 1, 0)
- TextLabel25.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel25.BorderSizePixel = 0
- TextLabel25.Font = Enum.Font.SourceSans
- TextLabel25.FontSize = Enum.FontSize.Size18
- TextLabel25.TextColor3 = Color3.new(1, 1, 1)
- TextLabel25.TextStrokeTransparency = 0.80000001192093
- TextLabel25.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel25.TextYAlignment = Enum.TextYAlignment.Top
- Frame26.Name = "_"
- Frame26.Parent = Frame23
- Frame26.Transparency = 0.5
- Frame26.Size = UDim2.new(1, 0, 1, 0)
- Frame26.Position = UDim2.new(0, 0, 0, -5)
- Frame26.BackgroundColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
- Frame26.BackgroundTransparency = 0.5
- Frame26.BorderSizePixel = 0
- Frame27.Name = "Border"
- Frame27.Parent = Frame26
- Frame27.Transparency = 0.5
- Frame27.Size = UDim2.new(1, 0, 0, 2)
- Frame27.Position = UDim2.new(0, 0, 0, -2)
- Frame27.BackgroundColor3 = Color3.new(0, 1, 0.85098)
- Frame27.BackgroundTransparency = 0.5
- Frame27.BorderSizePixel = 0
- Frame28.Name = "Border"
- Frame28.Parent = Frame26
- Frame28.Transparency = 0.5
- Frame28.Size = UDim2.new(1, 0, 0, 2)
- Frame28.Position = UDim2.new(0, 0, 1, 0)
- Frame28.BackgroundColor3 = Color3.new(0, 1, 0.886275)
- Frame28.BackgroundTransparency = 0.5
- Frame28.BorderSizePixel = 0
- ImageLabel29.Name = "Logo"
- ImageLabel29.Parent = Frame23
- ImageLabel29.Transparency = 1
- ImageLabel29.Size = UDim2.new(0, 100, 0, 100)
- ImageLabel29.Position = UDim2.new(0.5, -50, 0, -110)
- ImageLabel29.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel29.BackgroundTransparency = 1
- ImageLabel29.BorderSizePixel = 0
- ImageLabel29.ImageColor3 = Color3.new(0, 0, 0)
- TextLabel30.Name = "FiringMode"
- TextLabel30.Parent = Frame23
- TextLabel30.Text = "Firing Mode: Semi"
- TextLabel30.Position = UDim2.new(0, 4, 10, 0)
- TextLabel30.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel30.BorderSizePixel = 0
- TextLabel30.Font = Enum.Font.SourceSansBold
- TextLabel30.FontSize = Enum.FontSize.Size18
- TextLabel30.TextColor3 = Color3.new(1, 1, 1)
- TextLabel30.TextStrokeTransparency = 0.80000001192093
- TextLabel30.TextTransparency = 1
- TextLabel30.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel30.TextYAlignment = Enum.TextYAlignment.Top
- Part31.Name = "Light"
- Part31.Parent = Tool0
- Part31.CanCollide = false
- Part31.Size = Vector3.new(0.0500000007, 0.0500000007, 0.149999976)
- Part31.CFrame = CFrame.new(72.8948975, 172.431854, 252.964951, 1, 2.16004992e-12, 0, 2.26307861e-12, 1, 1.78260962e-10, 0, 1.78260962e-10, 1)
- Part31.Position = Vector3.new(72.8948975, 172.431854, 252.964951)
- SpotLight32.Name = "Light"
- SpotLight32.Parent = Part31
- SpotLight32.Color = Color3.new(0, 0.952941, 1)
- SpotLight32.Enabled = false
- SpotLight32.Brightness = 2
- SpotLight32.Range = 13
- SpotLight32.Shadows = true
- SpotLight32.Angle = 180
- SpotLight32.Face = Enum.NormalId.Top
- SpotLight32.Color = Color3.new(0, 0.952941, 1)
- Part33.Name = "Barrel"
- Part33.Parent = Tool0
- Part33.CanCollide = false
- Part33.Size = Vector3.new(0.0500000007, 0.0500000007, 0.149999976)
- Part33.CFrame = CFrame.new(72.8948975, 172.431854, 252.964951, 1, 2.16004992e-12, 0, 2.26307861e-12, 1, 1.78260962e-10, 0, 1.78260962e-10, 1)
- Part33.Position = Vector3.new(72.8948975, 172.431854, 252.964951)
- SpotLight34.Name = "Light"
- SpotLight34.Parent = Part33
- SpotLight34.Color = Color3.new(0, 0.952941, 1)
- SpotLight34.Enabled = false
- SpotLight34.Brightness = 2
- SpotLight34.Range = 13
- SpotLight34.Shadows = true
- SpotLight34.Angle = 180
- SpotLight34.Face = Enum.NormalId.Top
- SpotLight34.Color = Color3.new(0, 0.952941, 1)
- ParticleEmitter35.Name = "Flash"
- ParticleEmitter35.Parent = Part33
- ParticleEmitter35.Size = NumberSequence.new(0.30000001192093,0.30000001192093)
- ParticleEmitter35.Color = ColorSequence.new(Color3.new(0, 0.678431, 0.690196),Color3.new(0, 0.678431, 0.690196))
- ParticleEmitter35.LightEmission = 234
- ParticleEmitter35.Texture = "http://www.roblox.com/asset/?id=68683102"
- ParticleEmitter35.Lifetime = NumberRange.new(0.30000001192093, 0.30000001192093)
- ParticleEmitter35.Rate = 0
- ParticleEmitter35.Speed = NumberRange.new(0, 0)
- ParticleEmitter35.VelocitySpread = 50
- ParticleEmitter35.Color = ColorSequence.new(Color3.new(0, 0.678431, 0.690196),Color3.new(0, 0.678431, 0.690196))
- Tool36.Name = "Gravity Gun"
- Tool36.Parent = mas
- Part37.Name = "Light"
- Part37.Parent = Tool36
- Part37.Material = Enum.Material.SmoothPlastic
- Part37.BrickColor = BrickColor.new("Wheat")
- Part37.Transparency = 1
- Part37.Rotation = Vector3.new(-89.9899979, -0.00999999978, 1.46999991)
- Part37.CanCollide = false
- Part37.FormFactor = Enum.FormFactor.Custom
- Part37.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part37.CFrame = CFrame.new(73.5449829, 171.561371, 253.914093, 0.99967134, -0.0256340783, -0.000127324325, 0.000131124631, 0.00014657047, 1, -0.0256340597, -0.9996714, 0.000149883897)
- Part37.BottomSurface = Enum.SurfaceType.Smooth
- Part37.TopSurface = Enum.SurfaceType.Smooth
- Part37.Color = Color3.new(0.945098, 0.905882, 0.780392)
- Part37.Position = Vector3.new(73.5449829, 171.561371, 253.914093)
- Part37.Orientation = Vector3.new(-90, 1.46999991, 0)
- Part37.Color = Color3.new(0.945098, 0.905882, 0.780392)
- CylinderMesh38.Parent = Part37
- CylinderMesh38.Scale = Vector3.new(0.594444454, 0.05185185, 0.629629552)
- CylinderMesh38.Scale = Vector3.new(0.594444454, 0.05185185, 0.629629552)
- Part39.Name = "Flashlight"
- Part39.Parent = Tool36
- Part39.Material = Enum.Material.SmoothPlastic
- Part39.BrickColor = BrickColor.new("Dark stone grey")
- Part39.Transparency = 1
- Part39.Rotation = Vector3.new(0.0299999993, 1.49000001, -179.959991)
- Part39.CanCollide = false
- Part39.FormFactor = Enum.FormFactor.Custom
- Part39.Size = Vector3.new(0.200000003, 0.2074074, 0.200000003)
- Part39.CFrame = CFrame.new(73.5509644, 171.564972, 254.100647, -0.999662638, 0.000633242249, 0.0259669926, -0.000648298883, -0.999999642, -0.000571423909, 0.0259666219, -0.000588065828, 0.999662578)
- Part39.BottomSurface = Enum.SurfaceType.Smooth
- Part39.TopSurface = Enum.SurfaceType.Smooth
- Part39.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part39.Position = Vector3.new(73.5509644, 171.564972, 254.100647)
- Part39.Orientation = Vector3.new(0.0299999993, 1.49000001, -179.959991)
- Part39.Color = Color3.new(0.388235, 0.372549, 0.384314)
- SpecialMesh40.Parent = Part39
- SpecialMesh40.MeshId = "http://www.roblox.com/asset/?id=115955313"
- SpecialMesh40.Scale = Vector3.new(0.185185179, 0.185185179, 0.185185179)
- SpecialMesh40.VertexColor = Vector3.new(125, 125, 125)
- SpecialMesh40.MeshType = Enum.MeshType.FileMesh
- SpecialMesh40.Scale = Vector3.new(0.185185179, 0.185185179, 0.185185179)
- SpotLight41.Name = "Light"
- SpotLight41.Parent = Part39
- SpotLight41.Enabled = false
- SpotLight41.Brightness = 200
- SpotLight41.Range = 20
- SpotLight41.Shadows = true
- SpotLight41.Angle = 60
- Part42.Name = "Handle"
- Part42.Parent = Tool36
- Part42.BrickColor = BrickColor.new("Bright yellow")
- Part42.Transparency = 1
- Part42.Rotation = Vector3.new(0, 21.4099998, 0)
- Part42.CanCollide = false
- Part42.FormFactor = Enum.FormFactor.Custom
- Part42.Size = Vector3.new(0.300000012, 0.200000003, 0.200000003)
- Part42.CFrame = CFrame.new(73.3031616, 171.193665, 256.127441, 0.930995226, 2.43172035e-05, 0.365022629, -3.56544297e-05, 1, 2.43173708e-05, -0.365022629, -3.56541896e-05, 0.930995226)
- Part42.Color = Color3.new(0.960784, 0.803922, 0.188235)
- Part42.Position = Vector3.new(73.3031616, 171.193665, 256.127441)
- Part42.Orientation = Vector3.new(0, 21.4099998, 0)
- Part42.Color = Color3.new(0.960784, 0.803922, 0.188235)
- BlockMesh43.Parent = Part42
- BlockMesh43.Scale = Vector3.new(0.925926268, 0.0370371528, 0.62962985)
- BlockMesh43.Scale = Vector3.new(0.925926268, 0.0370371528, 0.62962985)
- Sound44.Name = "Fire"
- Sound44.Parent = Part42
- Sound44.Pitch = 2
- Sound44.SoundId = "rbxassetid://501798753"
- Sound45.Name = "EmptyMag"
- Sound45.Parent = Part42
- Sound45.Pitch = 0.80000001192093
- Sound45.SoundId = "rbxassetid://159385334"
- Sound46.Name = "Reload"
- Sound46.Parent = Part42
- Sound46.Pitch = 1.2000000476837
- Sound46.SoundId = "http://www.roblox.com/asset/?id=2697432"
- Sound47.Name = "FlashSound"
- Sound47.Parent = Part42
- Sound47.Pitch = 100
- Sound47.SoundId = "http://www.roblox.com/asset/?id=274924676"
- Part48.Name = "Trigger"
- Part48.Parent = Tool36
- Part48.BrickColor = BrickColor.new("Dusty Rose")
- Part48.Transparency = 1
- Part48.Rotation = Vector3.new(179.759995, -88.7599945, -0.219999999)
- Part48.Velocity = Vector3.new(1.40129846e-45, 0, 1.40129846e-45)
- Part48.CanCollide = false
- Part48.FormFactor = Enum.FormFactor.Custom
- Part48.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
- Part48.CFrame = CFrame.new(73.5487671, 171.301575, 255.85202, 0.0216009524, 8.30429344e-05, -0.999766648, -0.000301155, -1, -8.95690609e-05, -0.999766588, 0.000303019129, -0.0216009282)
- Part48.BackSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.RightSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.TopSurface = Enum.SurfaceType.SmoothNoOutlines
- Part48.Color = Color3.new(0.639216, 0.294118, 0.294118)
- Part48.Position = Vector3.new(73.5487671, 171.301575, 255.85202)
- Part48.Orientation = Vector3.new(0.00999999978, -91.2399979, -179.979996)
- Part48.Color = Color3.new(0.639216, 0.294118, 0.294118)
- BlockMesh49.Parent = Part48
- BlockMesh49.Scale = Vector3.new(0.799999952, 0.599999964, 0.799999952)
- BlockMesh49.Scale = Vector3.new(0.799999952, 0.599999964, 0.799999952)
- Part50.Name = "Mag"
- Part50.Parent = Tool36
- Part50.Material = Enum.Material.SmoothPlastic
- Part50.BrickColor = BrickColor.new("Mid gray")
- Part50.Reflectance = 0.30000001192093
- Part50.Transparency = 1
- Part50.Rotation = Vector3.new(0, -88.5099945, 180)
- Part50.CanCollide = false
- Part50.FormFactor = Enum.FormFactor.Custom
- Part50.Size = Vector3.new(0.249999985, 0.200000003, 0.200000003)
- Part50.CFrame = CFrame.new(73.5408325, 171.322449, 254.849274, -0.0259207282, -1.67640951e-06, -0.999663949, 0.00012946222, -1, -1.679913e-06, -0.999664009, -0.000129462613, 0.0259207282)
- Part50.BottomSurface = Enum.SurfaceType.Smooth
- Part50.TopSurface = Enum.SurfaceType.Smooth
- Part50.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part50.Position = Vector3.new(73.5408325, 171.322449, 254.849274)
- Part50.Orientation = Vector3.new(0, -88.5099945, 179.98999)
- Part50.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part51.Name = "Barrel"
- Part51.Parent = Tool36
- Part51.Material = Enum.Material.SmoothPlastic
- Part51.BrickColor = BrickColor.new("Dark stone grey")
- Part51.Rotation = Vector3.new(0.560000002, -88.5800018, 90.5699997)
- Part51.CanCollide = false
- Part51.FormFactor = Enum.FormFactor.Custom
- Part51.Size = Vector3.new(0.200000003, 0.200000003, 0.232538849)
- Part51.CFrame = CFrame.new(73.9038696, 171.456696, 254.052673, -0.000246524782, -0.0247177798, -0.999694586, 1.00000012, -0.000186324294, -0.000241875648, -0.000180065457, -0.999694645, 0.0247176904)
- Part51.BottomSurface = Enum.SurfaceType.Smooth
- Part51.TopSurface = Enum.SurfaceType.Smooth
- Part51.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part51.Position = Vector3.new(73.9038696, 171.456696, 254.052673)
- Part51.Orientation = Vector3.new(0.00999999978, -88.5800018, 90.0099945)
- Part51.Color = Color3.new(0.388235, 0.372549, 0.384314)
- SpotLight52.Name = "Light"
- SpotLight52.Parent = Part51
- SpotLight52.Color = Color3.new(1, 1, 0)
- SpotLight52.Enabled = false
- SpotLight52.Brightness = 2
- SpotLight52.Range = 13
- SpotLight52.Shadows = true
- SpotLight52.Angle = 180
- SpotLight52.Face = Enum.NormalId.Top
- SpotLight52.Color = Color3.new(1, 1, 0)
- ParticleEmitter53.Name = "Flash"
- ParticleEmitter53.Parent = Part51
- ParticleEmitter53.Size = NumberSequence.new(0.30000001192093,0.30000001192093)
- ParticleEmitter53.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0))
- ParticleEmitter53.LightEmission = 234
- ParticleEmitter53.Texture = "http://www.roblox.com/asset/?id=68683102"
- ParticleEmitter53.Lifetime = NumberRange.new(0.30000001192093, 0.30000001192093)
- ParticleEmitter53.Rate = 0
- ParticleEmitter53.Speed = NumberRange.new(0, 0)
- ParticleEmitter53.VelocitySpread = 50
- ParticleEmitter53.Color = ColorSequence.new(Color3.new(1, 1, 0.498039),Color3.new(1, 1, 0))
- Configuration54.Name = "Conditions"
- Configuration54.Parent = Tool36
- IntValue55.Name = "Ammo"
- IntValue55.Parent = Configuration54
- IntValue55.Value = 30
- BoolValue56.Name = "CanFire"
- BoolValue56.Parent = Configuration54
- BoolValue56.Value = true
- NumberValue57.Name = "MaxRecoil"
- NumberValue57.Parent = Configuration54
- NumberValue57.Value = 100
- NumberValue58.Name = "Recoil"
- NumberValue58.Parent = Configuration54
- Part59.Parent = Tool36
- Part59.Material = Enum.Material.Neon
- Part59.BrickColor = BrickColor.new("Bright orange")
- Part59.Transparency = 0.5
- Part59.Rotation = Vector3.new(-179.98999, -75, -179.98999)
- Part59.CanCollide = false
- Part59.Shape = Enum.PartType.Cylinder
- Part59.Size = Vector3.new(1.20000005, 0.649999976, 2)
- Part59.CFrame = CFrame.new(73.7000122, 171.475952, 254.700012, -0.258856148, 4.27887353e-05, -0.965915978, 5.63494723e-06, 1, 4.27885097e-05, 0.965915978, 5.63354115e-06, -0.258856148)
- Part59.Color = Color3.new(0.854902, 0.521569, 0.254902)
- Part59.Position = Vector3.new(73.7000122, 171.475952, 254.700012)
- Part59.Orientation = Vector3.new(0, -105, 0)
- Part59.Color = Color3.new(0.854902, 0.521569, 0.254902)
- Script60.Name = "Glow Script"
- Script60.Parent = Part59
- Script60.Disabled = true
- Part61.Name = "Shoot"
- Part61.Parent = Tool36
- Part61.Material = Enum.Material.Neon
- Part61.BrickColor = BrickColor.new("Br. yellowish orange")
- Part61.Reflectance = 0.30000001192093
- Part61.Transparency = 1
- Part61.Rotation = Vector3.new(106, -45, -90.0099945)
- Part61.CanCollide = false
- Part61.FormFactor = Enum.FormFactor.Custom
- Part61.Size = Vector3.new(1, 1, 1)
- Part61.CFrame = CFrame.new(73.7999878, 171.529968, 254.100006, -6.7233399e-05, 0.70712465, -0.707088947, 0.275642842, -0.679683387, -0.679743886, -0.96126014, -0.194949687, -0.194868132)
- Part61.BottomSurface = Enum.SurfaceType.Smooth
- Part61.TopSurface = Enum.SurfaceType.Smooth
- Part61.Color = Color3.new(0.886275, 0.607843, 0.25098)
- Part61.Position = Vector3.new(73.7999878, 171.529968, 254.100006)
- Part61.Orientation = Vector3.new(42.8199997, -105.409996, 157.929993)
- Part61.Color = Color3.new(0.886275, 0.607843, 0.25098)
- SpecialMesh62.Parent = Part61
- SpecialMesh62.MeshId = "http://www.roblox.com/asset/?id=1031410"
- SpecialMesh62.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- SpecialMesh62.MeshType = Enum.MeshType.FileMesh
- SpecialMesh62.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- Vector3Value63.Name = "SurfacePos"
- Vector3Value63.Parent = Tool36
- Vector3Value63.Value = Vector3.new(2, 3, 3)
- Script64.Name = "qPerfectionWeld"
- Script64.Parent = Tool36
- table.insert(cors,sandbox(Script64,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- -- Using a syntax hack to create a nice way to Make new items.
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- LocalScript65.Name = "GunCore"
- LocalScript65.Parent = Tool36
- table.insert(cors,sandbox(LocalScript65,function()
- --[[.
- ____ _____ _ ____ _____ ____
- | _ \| ____| / \ | _ \| ____| _ \
- | |_) | _| / _ \ | |_) | _| | |_) |
- | _ <| |___ / ___ \| __/| |___| _ <
- |_| \_\_____/_/ \_\_| |_____|_| \_\
- ___ _ _ ____ _ _ ____ _____ ____ ___ _____ ____
- |_ _| \ | | _ \| | | / ___|_ _| _ \|_ _| ____/ ___|
- | || \| | | | | | | \___ \ | | | |_) || || _| \___ \
- | || |\ | |_| | |_| |___) || | | _ < | || |___ ___) |
- |___|_| \_|____/ \___/|____/ |_| |_| \_\___|_____|____/
- ]] --(Teh)
- -- In partnership by ReaperIndustries, by CrakTheRaven and Revenus/HopeofRome
- -- not really this was made by Pragmatist but i like to take credit for things too xD
- local tool, player = script.Parent, game:GetService("Players").LocalPlayer
- -- CONFIGURATION --
- WeaponName = "Gravity Gun"; -- Weapon Name that shows up on the GUI text.
- BulletSpread = 1.1; -- Number of studs the bullet is offset (0 = no spread).
- WeaponType = "Auto"; -- "Auto" / "Semi"
- BulletColor = BrickColor.new("Bright orange"); -- BrickColor of the bullet.
- BulletTransparency = 100 -- Transparency of the bullet.
- BulletOrigin = tool:WaitForChild("Barrel"); -- What the bullet will shoot from.
- HitDamage = 17; -- How much damage the gun does.
- ObjectMultiplier = .3; -- Have an object you want to destroy? Object must have value of "Health"
- Cursor = "rbxasset://textures\\GunCursor.png"; -- Cursor that shows when the gun is equipped.
- HitSoundId = "rbxassetid://131864673"; -- Id of the HitSound
- HitSoundVolume = .7; -- Volume of the HitSound (make 0 if you don't want players to hear)
- MaxAmmo = 100; -- Maximum ammo per clip.
- FireRate = 0.00000001; -- Time between each shot.
- MeshType = "Block"; -- What kind of bullet you want shooting out of the gun (Block/Cylinder)
- Recoil = script.Parent.Conditions.Recoil.Value -- Value that determines reticle spacing
- MaxRecoil = script.Parent.Conditions.MaxRecoil.Value -- Maximum allowance for reticle parting
- TrueRecoil = script.Parent.Conditions.Recoil -- Spahgetti Coding variable, just to shorten things later
- -- Please don't touch anything below unless you know what you're doing! Thanks :)
- local Handle = tool:WaitForChild("Handle")
- local Barrel = tool:WaitForChild("Barrel")
- local Flashlight = tool:WaitForChild("Flashlight")
- local FakeLight = tool:WaitForChild("Light")
- local Conditions = tool:WaitForChild("Conditions")
- local AmmoCount = Conditions:WaitForChild("Ammo")
- local CanFire = Conditions:WaitForChild("CanFire")
- local Teams, ReplicatedStorage, UserInputService, RunService, Debris, Create = game:GetService("Teams"), game:GetService("ReplicatedStorage"), game:GetService("UserInputService"), game:GetService("RunService"), game:GetService("Debris"), LoadLibrary("RbxUtility").Create
- local Camera, PlayerGui, Backpack = workspace.CurrentCamera, player:WaitForChild("PlayerGui"), player:WaitForChild("Backpack")
- local BulletDump = workspace:WaitForChild("BulletDump") -- Required
- local ToolReplicator = ReplicatedStorage:WaitForChild("ToolReplicator") -- Required
- local HitSound = player.Backpack:FindFirstChild("HitSound") or Create("Sound"){Name = "HitSound", Pitch = 0.8, SoundId = HitSoundId, Volume = HitSoundVolume, Parent = player.Backpack}
- local FireSound, ReloadSound, EmptyMagSound,FlashSound = Handle:FindFirstChild("Fire"), Handle:FindFirstChild("Reload"), Handle:FindFirstChild("EmptyMag"), Handle:FindFirstChild("FlashSound")
- local Equipped, Reloading, Firing, MouseDown, Holster = false, false, false, false, false
- local ArmCFrames = {
- Left = CFrame.new(-0.232401475, 0.731157064, 1.02414107, 0.103974499, 0.97441268, -0.199301302, -0.473240495, 0.22472018, 0.851790786, 0.87477237, 0.00575334439, 0.484494328),
- Right = CFrame.new(-1.00000823, -0.100011915, 0.200000018, 0.866025448, 5.32910745e-014, -0.499999881, 0.499999881, -4.37115588e-008, 0.866025448, -2.18557332e-008, -0.999999881, -3.78553544e-008)
- }
- local HolsterCFrames = {
- Left = CFrame.new(-0.586823761, 0.480985105, 0.906768203, -0.0642859489, 0.782161772, -0.619750977, -0.431978822, 0.538023889, 0.723826647, 0.899590433, 0.314251065, 0.303290009),
- Right = CFrame.new(-0.973636985, -0.650349975, 0.0138454549, 0.696540296, 0.00785090867, -0.717475176, 0.682276845, 0.302280575, 0.665676713, 0.222104996, -0.95318675, 0.205194116)
- }
- local ReloadSequence = {
- {Time = 0.4, Left = CFrame.new(-0.209011436, 0.76324892, 0.78975606, -0.282254279, 0.907642782, 0.310671985, -0.493101478, -0.415047199, 0.76458323, 0.822911561, 0.0626139268, 0.564708829), Right = CFrame.new(-0.55685395, 0.463526368, 0.53752619, 0.954750538, -0.271960884, -0.120368935, 0.071148172, -0.184115022, 0.980326295, -0.288772106, -0.944531083, -0.156434402)},
- {Time = 0.6, Left = CFrame.new(-0.325837493, 0.707264721, 0.802219033, -0.2016415, 0.961395979, 0.187239349, -0.545462966, -0.269001901, 0.79379344, 0.81351763, 0.0579295866, 0.578647852), Right = CFrame.new(-0.736077189, 0.532853663, 0.507766426, 0.942081809, -0.258100748, -0.214163035, 0.11451336, -0.35264346, 0.928724527, -0.315227658, -0.899459004, -0.302662909)},
- {Time = 0.7, Left = CFrame.new(-0.495625108, 0.81194824, 0.587404788, -0.48886016, 0.869798005, 0.0668373406, -0.435639948, -0.309788495, 0.845132411, 0.755800009, 0.384034574, 0.53036195), Right = CFrame.new(-0.833003342, 0.573787272, 0.232965112, 0.942081809, -0.216990575, -0.255728126, 0.11451336, -0.50855732, 0.85337919, -0.315227658, -0.83323729, -0.45425418)},
- {Time = 0.8, Left = CFrame.new(-0.495624006, 0.672275305, 0.883890748, -0.488860488, 0.869798422, 0.0668372884, -0.722871542, -0.446785659, 0.52710402, 0.488336921, 0.209365755, 0.847167552), Right = CFrame.new(-0.898164988, 0.582640946, -0.0121643245, 0.938896179, -0.190729454, -0.286524475, 0.103399783, -0.63769573, 0.76331681, -0.328302413, -0.74630177, -0.57900846)},
- {Time = 0.9, Left = CFrame.new(-0.373379707, 0.768625379, 0.494097263, -0.313948035, 0.946735382, -0.0716073662, -0.406596929, -0.0659107566, 0.911226451, 0.857971728, 0.315193295, 0.405632436), Right = CFrame.new(-0.932295918, 0.531932712, 0.158023566, 0.917598903, -0.210251763, -0.337352186, 0.159367502, -0.582896173, 0.796764791, -0.364162415, -0.784873366, -0.501357317)},
- {Time = 1.1, Left = CFrame.new(-0.649042845, 0.6334849, 0.524738669, -0.338284612, 0.867902994, -0.363741338, -0.509759367, 0.155902475, 0.846073508, 0.791017711, 0.47163415, 0.389682144), Right = CFrame.new(-0.787839651, 0.494286418, 0.505542278, 0.917598903, -0.280750751, -0.281409532, 0.159367502, -0.388723493, 0.907466888, -0.364162415, -0.877537966, -0.311949492)},
- {Time = 1.2, Left = CFrame.new(-0.765217423, 0.393802643, 0.583889008, -0.262994021, 0.845609963, -0.464519083, -0.55953896, 0.258544832, 0.787445486, 0.785971105, 0.467010081, 0.405155957), Right = CFrame.new(-0.965098858, 0.319458991, 0.614931285, 0.957236052, -0.105651543, -0.269326746, 0.242726684, -0.213278487, 0.946359336, -0.15742588, -0.971261859, -0.178513214)},
- {Time = 1.4, Left = CFrame.new(-0.388958633, 0.387100548, 1.23408377, 0.198175311, 0.970845222, -0.134855196, -0.738777578, 0.238368183, 0.630387425, 0.644153416, -0.0252991598, 0.764476895), Right = CFrame.new(-0.850272775, -9.7155571e-006, 0.720583975, 0.957235992, -0.209575221, -0.199442521, 0.242726728, 0.206652865, 0.947828233, -0.157425791, -0.95570457, 0.248685315)},
- {Time = 1.6, Left = CFrame.new(-0.307948738, 0.580714345, 0.879842877, 0.0535680652, 0.998491168, -0.0120923854, -0.691506028, 0.0458293781, 0.720915675, 0.720381916, -0.0302561019, 0.692917407), Right = CFrame.new(-0.942968845, 0.159364432, 0.402672172, 0.957235992, -0.155100465, -0.244219035, 0.242726728, -0.0287858695, 0.969667554, -0.157425791, -0.987478495, 0.0100925863)},
- {Time = 1.8, Left = ArmCFrames.Left, Right = ArmCFrames.Right},
- }
- local LightSequence = {
- {Time = 0.2, Left = CFrame.new(-0.209011436, 0.76324892, 0.78975606, -0.282254279, 0.907642782, 0.310671985, -0.493101478, -0.415047199, 0.76458323, 0.822911561, 0.0626139268, 0.564708829)},
- {Time = 0.4, Left = ArmCFrames.Left, Right = ArmCFrames.Right},
- }
- local CoreBullet = Create("Part"){
- Name = "Bullet";
- BrickColor = BulletColor;
- Material = Enum.Material.Neon;
- FormFactor = Enum.FormFactor.Custom;
- Size = Vector3.new(1, 1, 1);
- Transparency = 0.7;
- Anchored = true;
- CanCollide = false;
- Locked = true;
- Create(MeshType == "Block" and "BlockMesh" or MeshType == "Cylinder" and "CylinderMesh" or "BlockMesh"){
- Name = "Mesh",
- Scale = Vector3.new(0.15, 0.15, 1)
- }
- }
- local CoreBullet2 = Create("Part"){
- Name = "ShowBullet";
- BrickColor = BulletColor;
- Material = Enum.Material.SmoothPlastic;
- FormFactor = Enum.FormFactor.Custom;
- Size = Vector3.new(1, 1, 1);
- Transparency = 0.5;
- Anchored = true;
- CanCollide = false;
- Locked = true;
- Create(MeshType == "Block" and "BlockMesh" or MeshType == "Cylinder" and "CylinderMesh" or "BlockMesh"){
- Name = "Mesh",
- Scale = Vector3.new(0.1, 0.1, 1)
- }
- }
- AmmoCount.Value = MaxAmmo
- repeat wait(0.03) until player.Character
- repeat wait(0.03) until #player.Character:GetChildren() > 10
- function TweenWeld(arm, newCFrame, seconds)
- local torso = player.Character:FindFirstChild("Torso")
- local weld = arm == "Left" and torso:FindFirstChild("LeftArmWeld") or arm == "Right" and torso:FindFirstChild("RightArmWeld")
- if weld then
- local startCF, endCF = weld.C1, newCFrame
- local startPos, startRot = startCF.p, Vector3.new(startCF:toEulerAnglesXYZ())
- local endPos, endRot = endCF.p, Vector3.new(endCF:toEulerAnglesXYZ())
- local diffPos, diffRot = (endPos - startPos), (endRot - startRot)
- local new
- for i = 0, 1, 1/seconds/30 do
- if not weld or not Equipped then break end
- new = CFrame.new(startPos+diffPos * i) * CFrame.Angles(startRot.X+diffRot.X * i, startRot.Y+diffRot.Y * i, startRot.Z+diffRot.Z * i)
- weld.C1 = new
- wait()
- end
- weld.C1 = endCF
- end
- end
- function WeldArms(c1,lArm,rArm)
- local prop = c1 and "C1" or "C0"
- local char = player.Character
- local torso = char:WaitForChild("Torso")
- local lShoulder,rShoulder = torso:FindFirstChild("Left Shoulder"),torso:FindFirstChild("Right Shoulder")
- if lArm and lShoulder then
- lShoulder.Part1 = nil
- Create("Weld"){
- Name = "LeftArmWeld",
- [prop] = lArm,
- Part0 = torso,
- Part1 = char:FindFirstChild("Left Arm"),
- Parent = torso
- }
- elseif lShoulder and torso:FindFirstChild("LeftArmWeld") then
- torso["LeftArmWeld"]:Remove()
- lShoulder.Part1 = char:FindFirstChild("Left Arm")
- end
- if rArm and rShoulder then
- rShoulder.Part1 = nil
- Create("Weld"){
- Name = "RightArmWeld",
- [prop] = rArm,
- Part0 = torso,
- Part1 = char:FindFirstChild("Right Arm"),
- Parent = torso
- }
- elseif rShoulder and torso:FindFirstChild("RightArmWeld") then
- torso["RightArmWeld"]:Remove()
- rShoulder.Part1 = char:FindFirstChild("Right Arm")
- end
- end
- function PseudoArms(bool)
- if not type(bool) == "boolean" then print("not a boolean parameter") return end
- local function destroy()
- if Camera:FindFirstChild("FakeArms") then
- Camera:FindFirstChild("FakeArms"):Destroy()
- end
- end
- local function create()
- destroy()
- local ArmsModel = Create("Model"){
- Name = "FakeArms",
- Parent = Camera,
- Create("Humanoid"){Name = "_"},
- }
- local FakeShirt = player.Character:FindFirstChild("Shirt")
- if FakeShirt then FakeShirt:Clone().Parent = ArmsModel end
- local FakeLeftArm = player.Character:FindFirstChild("Left Arm"):Clone()
- FakeLeftArm.Size = Vector3.new(0.9, 2, 0.9)
- FakeLeftArm.Parent = ArmsModel
- local FakeRightArm = player.Character:FindFirstChild("Right Arm"):Clone()
- FakeRightArm.Size = Vector3.new(0.9, 2, 0.9)
- FakeRightArm.Parent = ArmsModel
- Create("Weld"){
- Parent = ArmsModel,
- Name = "FakeLeftShoulder",
- Part0 = player.Character["Left Arm"],
- Part1 = FakeLeftArm
- }
- Create("Weld"){
- Parent = ArmsModel,
- Name = "FakeRightShoulder",
- Part0 = player.Character["Right Arm"],
- Part1 = FakeRightArm
- }
- end
- if bool then
- create()
- else
- destroy()
- end
- end
- function Light(bool,rate)
- if not type(bool) == "boolean" then print("not a boolean parameter") return end
- Barrel.Flash.Rate = rate
- Barrel.Light.Enabled = bool
- end
- function GetGUI()
- local result = PlayerGui:FindFirstChild("CrusaderGui")
- if result then
- return result
- end
- end
- function UpdateGUI()
- local Gui = GetGUI()
- Gui.Weapon.WeaponName.Text = WeaponName
- Gui.Weapon.Ammo.Text = AmmoCount.Value
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- end
- function GetHumanoid(target)
- local humanoid
- humanoid = target.Parent:FindFirstChild("Humanoid")
- if not humanoid and target.Parent.Parent ~= nil then
- humanoid = target.Parent.Parent:FindFirstChild("Humanoid")
- end
- return humanoid
- end
- function IsADefender(me, victim)
- if me.TeamColor == victim.TeamColor then
- return true
- end
- return false
- end
- function DrawLaser(init, at)
- local length = (at-init).magnitude
- local origin = CFrame.new(init, at)
- local Laser1 = CoreBullet:Clone()
- Laser1.CFrame = origin * CFrame.new(0, 0, -length/2) * CFrame.Angles(math.rad(90), 0, 0)
- Laser1.Mesh.Scale = Vector3.new(Laser1.Mesh.Scale.x, length, Laser1.Mesh.Scale.x)
- Laser1.Parent = BulletDump
- Debris:AddItem(Laser1, 0.03)
- local Laser2 = CoreBullet2:Clone()
- Laser2.CFrame = origin * CFrame.new(0, 0, -length/2) * CFrame.Angles(math.rad(90), 0, 0)
- Laser2.Mesh.Scale = Vector3.new(Laser1.Mesh.Scale.x*.5, length, Laser1.Mesh.Scale.x*.5)
- Laser2.Parent = BulletDump
- Debris:AddItem(Laser2, 0.03)
- end
- function CreateRaycast(root, last, ignore)
- local direction = (last - root).unit
- local ray = Ray.new(root, direction * 999)
- local hit, at, surface = workspace:FindPartOnRayWithIgnoreList(ray, ignore)
- tool.SurfacePos.Value = surface
- if hit and hit.Name == "Ray" then
- hit, at, surface = CreateRaycast(at, direction * 999, ignore)
- end
- return hit, at, surface
- end
- function CreateEffect(position, part)
- local dot = game.ReplicatedStorage.dot:Clone()
- dot.Parent = workspace.BulletDump
- dot.CFrame = position
- if not part.Parent:FindFirstChild("Humanoid")and part.Parent:IsA("Tool") == false and part.Parent:IsA("Hat") == false then
- if part.Material == Enum.Material.Plastic or part.Material == Enum.Material.SmoothPlastic then
- ToolReplicator:FireServer("ChangePlasticEffect", dot)
- elseif part.Material == Enum.Material.Grass then --print("Grass") -- grass
- ToolReplicator:FireServer("ChangeGrassEffect", dot)
- elseif part.Material == Enum.Material.Wood then --print("Wood") -- wood
- ToolReplicator:FireServer("ChangeWoodEffect", dot)
- elseif part.Material == Enum.Material.Metal then-- print("Metal") -- metal
- ToolReplicator:FireServer("ChangeMetalEffect", dot)
- end
- elseif part.Parent:FindFirstChild("Humanoid") or part.Parent:IsA("Hat") then
- ToolReplicator:FireServer("ChangeBloodEffect",dot)
- elseif part.Parent:IsA("Tool") then
- ToolReplicator:FireServer("ChangeMetalEffect", dot)
- end
- local rel = tool.SurfacePos.Value -- Calculating the face
- if (math.abs(rel.Z) > math.abs(rel.Y) and math.abs(rel.Z) > math.abs(rel.X)) then
- if (rel.Z > 0) then
- dot.Effect.EmissionDirection = "Back"
- dot.Dust.EmissionDirection = "Back"
- else
- dot.Effect.EmissionDirection = "Front"
- dot.Dust.EmissionDirection = "Front"
- end
- elseif (math.abs(rel.Y) > math.abs(rel.Z) and math.abs(rel.Y) > math.abs(rel.X)) then
- if (rel.Y > 0) then
- dot.Effect.EmissionDirection = "Top"
- dot.Dust.EmissionDirection = "Top"
- else
- dot.Effect.EmissionDirection = "Bottom"
- dot.Dust.EmissionDirection = "Bottom"
- end
- elseif (math.abs(rel.X) > math.abs(rel.Z) and math.abs(rel.X) > math.abs(rel.Y)) then
- if (rel.X > 0) then
- dot.Effect.EmissionDirection = "Right"
- dot.Dust.EmissionDirection = "Right"
- else
- dot.Effect.EmissionDirection = "Left"
- dot.Dust.EmissionDirection = "Left"
- end
- end
- Debris:AddItem(dot, 0.3)
- end
- function FireLaser(mouse, count)
- local aimPos = mouse.hit.p
- local bulletOrigin = BulletOrigin.Position
- local distance = (bulletOrigin - aimPos).magnitude
- if Recoil < MaxRecoil then -- revenus spahgetti scripting confirmed
- Recoil = Recoil + 5
- ReticleUpdate(mouse)
- end
- for i = 1, count do
- local aimWithSpread = Vector3.new((aimPos.x)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)),(aimPos.y)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)),(aimPos.z)+(math.random(-(BulletSpread/10)*distance,(BulletSpread/10)*distance)))
- local collision, collisionPos = CreateRaycast(player.Character.Head.Position, aimWithSpread, { player.Character, Camera, workspace.BulletDump, workspace.ServerScriptService})
- DrawLaser(bulletOrigin, collisionPos)
- if collision then
- CreateEffect(CFrame.new(collisionPos), collision)
- local humanoid = GetHumanoid(collision)
- if humanoid and humanoid:IsA("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name) then
- local target = game.Players:FindFirstChild(humanoid.Parent.Name)
- if target and (not IsADefender(player, target) or target.Neutral) then
- ToolReplicator:FireServer("DamageHumanoid", humanoid, HitDamage)
- -- local Gui = GetGUI()
- player.PlayerGui.MouseGUI.Hit.Visible = true
- HitSound:Play()
- delay(0.1, function() player.PlayerGui.MouseGUI.Hit.Visible = false end)
- end
- elseif collision and collision.Parent.Parent.Name == "DestroyableObjects" then
- ToolReplicator:FireServer("DamageObject", collision, HitDamage)
- elseif collision and collision.Name == "Glass" then
- ToolReplicator:FireServer("DestroyWindows",collision)
- end
- end
- end
- end
- function FireBullet(mouse)
- CanFire.Value = false
- Barrel.Light.Angle = math.random(75, 200)
- Light(true,50)
- FireLaser(mouse, 1)
- FireSound:Play()
- AmmoCount.Value = AmmoCount.Value - 1
- wait(FireRate)
- CanFire.Value = true
- end
- function ReloadAnimation()
- local Animation = ReloadSequence
- for index, keyframe in next, Animation do
- for limb, cframe in next, keyframe do
- if limb ~= "Time" then
- spawn(function()
- local prevKeyframe = Animation[index - 1]
- local waitTime = prevKeyframe and prevKeyframe.Time or 0
- wait(waitTime)
- if not Equipped then return end
- TweenWeld(limb, cframe, keyframe.Time - waitTime)
- end)
- end
- end
- end
- wait(Animation[#Animation].Time)
- end
- function LightAnimation()
- local Animation = LightSequence
- for index, keyframe in next, Animation do
- for limb, cframe in next, keyframe do
- if limb ~= "Time" then
- spawn(function()
- local prevKeyframe = Animation[index - 1]
- local waitTime = prevKeyframe and prevKeyframe.Time or 0
- wait(waitTime)
- if not Equipped then return end
- TweenWeld(limb, cframe, keyframe.Time - waitTime)
- end)
- end
- end
- end
- wait(Animation[#Animation].Time)
- end
- function Reload()
- if AmmoCount.Value == MaxAmmo then return end
- EmptyMagSound:Play()
- Reloading = true
- Light(false,0)
- ReloadSound:Play()
- local Gui = GetGUI()
- spawn(function()
- for i = 0, 0.5, 0.05 do
- wait(0)
- pcall(function()
- Gui.Weapon.Logo.ImageTransparency = i
- end)
- end
- end)
- Gui.Weapon.Ammo.Text = "REL"
- ReloadAnimation()
- spawn(function()
- for i = 0.5, 0, -0.05 do
- wait(0)
- pcall(function()
- Gui.Weapon.Logo.ImageTransparency = i
- end)
- end
- end)
- if not Reloading then return end
- AmmoCount.Value = MaxAmmo
- Reloading = false
- end
- function ForceProperWelds()
- coroutine.wrap(TweenWeld)("Left", ArmCFrames.Left, 0.1)
- coroutine.wrap(TweenWeld)("Right", ArmCFrames.Right, 0.1)
- end
- function KeyPressed(mouse, key)
- key = key:lower()
- if key == "r" and not Reloading and Equipped then
- Reload()
- elseif key == "e" and Equipped then
- LightAnimation()
- FlashSound:Play()
- Flashlight.Light.Enabled = not Flashlight.Light.Enabled
- if FakeLight.Material == Enum.Material.Neon then FakeLight.Material = Enum.Material.SmoothPlastic else
- FakeLight.Material = Enum.Material.Neon
- end
- elseif key == "f" and not Reloading and not Firing and Equipped then
- if not Holster then
- Holster = true
- coroutine.wrap(TweenWeld)("Left", HolsterCFrames.Left, 0.1)
- coroutine.wrap(TweenWeld)("Right", HolsterCFrames.Right, 0.1)
- player.Character.Humanoid.WalkSpeed = 24
- else
- Holster = false
- ForceProperWelds()
- player.Character.Humanoid.WalkSpeed = 16
- end
- elseif key == "v" and not Reloading and not Firing and Equipped then
- local Gui = GetGUI()
- LightAnimation()
- FlashSound:Play()
- if WeaponType == "Auto" then
- WeaponType = "Semi"
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- HitDamage = HitDamage + 2
- else
- WeaponType = "Auto"
- Gui.Weapon.FiringMode.Text = "Firing mode: "..WeaponType
- HitDamage = HitDamage - 2
- end
- end
- end
- function InitiateFire(mouse)
- if Reloading or Firing or not MouseDown or not CanFire.Value or (player.Character.Humanoid and player.Character.Humanoid.Health <= 0) then return end
- Firing = true
- if WeaponType == "Auto" then
- while MouseDown and Equipped and AmmoCount.Value > 0 and CanFire.Value and Firing and not Reloading and (player.Character.Humanoid and player.Character.Humanoid.Health > 0) do
- FireBullet(mouse)
- end
- elseif WeaponType == "Semi" then
- if Equipped and not Reloading then
- FireBullet(mouse)
- end
- end
- if AmmoCount.Value <= 0 then
- Reload()
- end
- Firing = false
- Light(false,0)
- end
- function Mouse1Down(mouse)
- if player.Character.Humanoid.Health <= 0 or not Equipped then return end
- if not Firing and not MouseDown and not Reloading and player.Character.Humanoid.Health > 0 and CanFire.Value then
- MouseDown = true
- player.Character.Humanoid.WalkSpeed = 16
- if Holster then
- Holster = false
- ForceProperWelds()
- end
- if AmmoCount.Value <= 0 then
- Reload()
- end
- InitiateFire(mouse)
- end
- end
- function Mouse1Up(mouse)
- MouseDown = false
- Light(false,0)
- end
- function ReticleUpdate(mouse)
- MouseGUI = player.PlayerGui.MouseGUI -- mouse gui important!!!!!!
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseUp.Position = UDim2.new(0, mouse.X-2, 0, mouse.Y-30-Recoil)
- MouseGUI.MouseDown.Position = UDim2.new(0, mouse.X-2, 0, mouse.Y+5+Recoil)
- MouseGUI.MouseLeft.Position = UDim2.new(0, mouse.X-30-Recoil, 0, mouse.Y-2)
- MouseGUI.MouseRight.Position = UDim2.new(0, mouse.X+5+Recoil, 0, mouse.Y-2)
- MouseGUI.Hit.Position = UDim2.new(0, mouse.X-32, 0, mouse.Y-32)
- end
- player.Character:WaitForChild("Humanoid").Died:connect(function()
- if PlayerGui:FindFirstChild("CrusaderGui") then
- PlayerGui.CrusaderGui:Destroy()
- end
- if Camera:FindFirstChild("FakeArms") then
- Camera:FindFirstChild("FakeArms"):Destroy()
- end
- end)
- tool.Equipped:connect(function(mouse)
- local GUI = script.MouseGUI:clone()
- GUI.Parent = player.PlayerGui
- TrueRecoil.Changed:connect(function()
- ReticleUpdate()
- end)
- mouse.Icon = "http://www.roblox.com/asset/?id=35446049"
- local newCrusGui
- if script:FindFirstChild("CrusaderGui") then
- newCrusGui = script.CrusaderGui:Clone()
- newCrusGui.Parent = PlayerGui
- newCrusGui:FindFirstChild("Weapon"):TweenPosition(UDim2.new(0.8, 0,0.8, 0), "Out", "Quad", .7, true)
- end
- Equipped = true
- WeldArms("C1", ArmCFrames.Left, ArmCFrames.Right)
- mouse.Button1Down:connect(function() Mouse1Down(mouse) end)
- mouse.Button1Up:connect(function() Mouse1Up(mouse) end)
- mouse.KeyDown:connect(function(key) KeyPressed(mouse, key) end)
- mouse.Move:connect(function()
- ReticleUpdate(mouse)
- if newCrusGui then
- local mTarget = mouse.Target
- if mTarget and mTarget.Parent then
- local humanoid = GetHumanoid(mTarget)
- if humanoid and humanoid:IsA("Humanoid") and game.Players:FindFirstChild(humanoid.Parent.Name) then
- local target = game.Players:FindFirstChild(humanoid.Parent.Name)
- if target and (not IsADefender(player, target) or target.Neutral) then --enemy
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.Red().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.Red().Color
- elseif target and (IsADefender(player, target) and not target.Neutral) then --ally
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.Green().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.Green().Color
- end
- else --neutral
- MouseGUI.MouseUp.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseDown.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseLeft.BackgroundColor3 = BrickColor.White().Color
- MouseGUI.MouseRight.BackgroundColor3 = BrickColor.White().Color
- end
- end
- end
- end)
- AmmoCount.Changed:connect(function()
- UpdateGUI()
- end)
- local pMouse = player:GetMouse()
- PseudoArms(true)
- UpdateGUI()
- player.Character.Humanoid.WalkSpeed = 16
- while Equipped do
- if MouseDown == false and (Recoil > 0) then
- Recoil = Recoil - 1.25
- ReticleUpdate(mouse)
- end
- wait(0.0125)
- end
- end)
- tool.Unequipped:connect(function()
- if PlayerGui:FindFirstChild("CrusaderGui") then
- PlayerGui.CrusaderGui:Destroy()
- end
- local reviscool = player.PlayerGui:GetChildren()
- for i=1, #reviscool do
- if (reviscool[i].Name == "MouseGUI") then
- reviscool[i]:remove()
- end
- end
- UserInputService.MouseIconEnabled = true
- Equipped = false
- Firing = false
- MouseDown = false
- Reloading = false
- Holster = false
- Light(false,0)
- WeldArms("")
- PseudoArms(false)
- Flashlight.Light.Enabled = false
- end)
- end))
- ScreenGui66.Name = "MouseGUI"
- ScreenGui66.Parent = LocalScript65
- Frame67.Name = "MouseDown"
- Frame67.Parent = ScreenGui66
- Frame67.Size = UDim2.new(0, 4, 0, 25)
- Frame67.Position = UDim2.new(0, 0, 0, 50)
- Frame67.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame67.BorderColor3 = Color3.new(0, 0, 0)
- Frame68.Name = "MouseLeft"
- Frame68.Parent = ScreenGui66
- Frame68.Size = UDim2.new(0, 25, 0, 4)
- Frame68.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame68.BorderColor3 = Color3.new(0, 0, 0)
- Frame69.Name = "MouseRight"
- Frame69.Parent = ScreenGui66
- Frame69.Size = UDim2.new(0, 25, 0, 4)
- Frame69.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame69.BorderColor3 = Color3.new(0, 0, 0)
- Frame70.Name = "MouseUp"
- Frame70.Parent = ScreenGui66
- Frame70.Size = UDim2.new(0, 4, 0, 25)
- Frame70.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame70.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel71.Name = "Hit"
- ImageLabel71.Parent = ScreenGui66
- ImageLabel71.Transparency = 1
- ImageLabel71.Size = UDim2.new(0, 64, 0, 64)
- ImageLabel71.Visible = false
- ImageLabel71.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel71.BackgroundTransparency = 1
- ImageLabel71.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel71.BorderSizePixel = 0
- ImageLabel71.Image = "http://www.roblox.com/asset/?id=84799964"
- ScreenGui72.Name = "CrusaderGui"
- ScreenGui72.Parent = LocalScript65
- Frame73.Name = "Weapon"
- Frame73.Parent = ScreenGui72
- Frame73.Transparency = 1
- Frame73.Size = UDim2.new(0, 160, 0, 4)
- Frame73.Position = UDim2.new(0.800000012, 0, 2, 0)
- Frame73.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame73.BackgroundTransparency = 1
- Frame73.BorderSizePixel = 0
- TextLabel74.Name = "Ammo"
- TextLabel74.Parent = Frame73
- TextLabel74.Text = "0"
- TextLabel74.Position = UDim2.new(0, 120, 0, -2)
- TextLabel74.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel74.BorderSizePixel = 0
- TextLabel74.Font = Enum.Font.SourceSansBold
- TextLabel74.FontSize = Enum.FontSize.Size36
- TextLabel74.TextColor3 = Color3.new(1, 1, 1)
- TextLabel74.TextStrokeTransparency = 0.80000001192093
- TextLabel74.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel74.TextYAlignment = Enum.TextYAlignment.Top
- TextLabel75.Name = "WeaponName"
- TextLabel75.Parent = Frame73
- TextLabel75.Text = "WeaponName"
- TextLabel75.Position = UDim2.new(0, 4, 1, 0)
- TextLabel75.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel75.BorderSizePixel = 0
- TextLabel75.Font = Enum.Font.SourceSans
- TextLabel75.FontSize = Enum.FontSize.Size18
- TextLabel75.TextColor3 = Color3.new(1, 1, 1)
- TextLabel75.TextStrokeTransparency = 0.80000001192093
- TextLabel75.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel75.TextYAlignment = Enum.TextYAlignment.Top
- Frame76.Name = "_"
- Frame76.Parent = Frame73
- Frame76.Transparency = 0.5
- Frame76.Size = UDim2.new(1, 0, 1, 0)
- Frame76.Position = UDim2.new(0, 0, 0, -5)
- Frame76.BackgroundColor3 = Color3.new(0.0980392, 0.0980392, 0.0980392)
- Frame76.BackgroundTransparency = 0.5
- Frame76.BorderSizePixel = 0
- Frame77.Name = "Border"
- Frame77.Parent = Frame76
- Frame77.Transparency = 0.5
- Frame77.Size = UDim2.new(1, 0, 0, 2)
- Frame77.Position = UDim2.new(0, 0, 0, -2)
- Frame77.BackgroundColor3 = Color3.new(1, 0.666667, 0)
- Frame77.BackgroundTransparency = 0.5
- Frame77.BorderSizePixel = 0
- Frame78.Name = "Border"
- Frame78.Parent = Frame76
- Frame78.Transparency = 0.5
- Frame78.Size = UDim2.new(1, 0, 0, 2)
- Frame78.Position = UDim2.new(0, 0, 1, 0)
- Frame78.BackgroundColor3 = Color3.new(1, 0.666667, 0)
- Frame78.BackgroundTransparency = 0.5
- Frame78.BorderSizePixel = 0
- ImageLabel79.Name = "Logo"
- ImageLabel79.Parent = Frame73
- ImageLabel79.Transparency = 1
- ImageLabel79.Size = UDim2.new(0, 100, 0, 100)
- ImageLabel79.Position = UDim2.new(0.5, -50, 0, -110)
- ImageLabel79.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel79.BackgroundTransparency = 1
- ImageLabel79.BorderSizePixel = 0
- ImageLabel79.ImageColor3 = Color3.new(0, 0, 0)
- TextLabel80.Name = "FiringMode"
- TextLabel80.Parent = Frame73
- TextLabel80.Text = "Firing Mode: Semi"
- TextLabel80.Position = UDim2.new(0, 4, 10, 0)
- TextLabel80.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel80.BorderSizePixel = 0
- TextLabel80.Font = Enum.Font.SourceSansBold
- TextLabel80.FontSize = Enum.FontSize.Size18
- TextLabel80.TextColor3 = Color3.new(1, 1, 1)
- TextLabel80.TextStrokeTransparency = 0.80000001192093
- TextLabel80.TextTransparency = 1
- TextLabel80.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel80.TextYAlignment = Enum.TextYAlignment.Top
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement