if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
print("FE Compatibility code by MagicalAndy6610")
InternalData = {}
do
script.Parent = owner.Character
local Event = Instance.new("RemoteEvent")
Event.Name = "UserInput"
local function NewFakeEvent()
local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect
return Fake
end
local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
end};ContextActionService.UnBindAction = ContextActionService.BindAction
local function TriggerEvent(self,Event,...)
local Trigger = Mouse[Event]
if Trigger and Trigger.fakeEvent and Trigger.Function then
Trigger.Function(...)
end
end
Mouse.TrigEvent = TriggerEvent
UserInputService.TrigEvent = TriggerEvent
Event.OnServerEvent:Connect(function(FiredBy,Input)
if FiredBy.Name ~= owner.Name then end
if Input.MouseEvent then
Mouse.Target = Input.Target
Mouse.Hit = Input.Hit
else
local Begin = Input.UserInputState == Enum.UserInputState.Begin
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up")
end
for _,Action in pairs(ContextActionService.Actions) do
for _,Key in pairs(Action.Keys) do
if Key==Input.KeyCode then
Action.Function(Action.Name,Input.UserInputState,Input)
end
end
end
Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
end
end)
InternalData["Mouse"] = Mouse
InternalData["ContextActionService"] = ContextActionService
InternalData["UserInputService"] = UserInputService
Event.Parent = NLS([[
local Player = owner
local Event = script:WaitForChild("UserInput")
local UserInputService = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local Input = function(Input,gameProcessedEvent)
if gameProcessedEvent then return end
Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
end
UserInputService.InputBegan:Connect(Input)
UserInputService.InputEnded:Connect(Input)
local Hit,Target
while wait(1/30) do
if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
Hit,Target = Mouse.Hit,Mouse.Target
Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
end
end
]],owner.Character)
end
RealGame = game;game = setmetatable({},{
__index = function (self,Index)
local Sandbox = function (Thing)
if Thing:IsA("Player") then
local RealPlayer = Thing
return setmetatable({},{
__index = function (self,Index)
local Type = type(RealPlayer[Index])
if Type == "function" then
if Index:lower() == "getmouse" or Index:lower() == "mouse" then
return function (self)
return InternalData["Mouse"]
end
end
return function (self,...)
return RealPlayer[Index](RealPlayer,...)
end
else
if Index == "PlrObj" then
return RealPlayer
end
return RealPlayer[Index]
end
end;
__tostring = function(self)
return RealPlayer.Name
end
})
end
end
if RealGame[Index] then
local Type = type(RealGame[Index])
if Type == "function" then
if Index:lower() == "getservice" or Index:lower() == "service" then
return function (self,Service)
if Service:lower() == "players" then
return setmetatable({},{
__index = function (self2,Index2)
local RealService = RealGame:GetService(Service)
local Type2 = type(Index2)
if Type2 == "function" then
return function (self,...)
return RealService[Index2](RealService,...)
end
else
if Index2:lower() == "localplayer" then
return Sandbox(owner)
end
return RealService[Index2]
end
end;
__tostring = function(self)
return RealGame:GetService(Service).Name
end
})
elseif Service:lower() == "contextactionservice" then
return InternalData["ContextActionService"]
elseif Service:lower() == "contextactionservice" then
return InternalData["UserInputService"]
elseif Service:lower() == "runservice" then
return setmetatable({},{
__index = function(self2,Index2)
local RealService = RealGame:GetService(Service)
local Type2 = type(Index2)
if Type2 == "function" then
return function (self,...)
return RealService[Index2](RealService,...)
end
else
if Index2:lower() == "bindtorenderstep" then
return function (self,Name,Priority,Function)
return RealGame:GetService("RunService").Stepped:Connect(Function)
end
end
if Index2:lower() == "renderstepped" then
return RealService["Stepped"]
end
return RealService[Index2]
end
end
})
else
return RealGame:GetService(Service)
end
end
end
return function (self,...)
return RealGame[Index](RealGame,...)
end
else
if game:GetService(Index) then
return game:GetService(Index)
end
return RealGame[Index]
end
else
return nil
end
end
});Game = game;owner = game:GetService("Players").LocalPlayer;script = {}
print("Complete! Running...")
function weldBetween(a, b)
--Make a new Weld and Parent it to a.
weld = Instance.new("ManualWeld", a)
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Set the Part0 and Part1 properties respectively
weld.Part0 = a
weld.Part1 = b
--Return the reference to the weld so that you can change it later.
return weld
end
--- THE BELOW WILL FILTER ALL OBJS THAT APPEAR IN WORKSPACE WITH A TEXT PROPERTY
do
local filteredMessages = { ['___'] = '___' };
local onPropertyChanged = function (obj)
if (obj:isDescendantOf (workspace)) then
local objText = obj.Text;
if (objText ~= '___' and objText:find '(%S)') then
if (filteredMessages [objText] and filteredMessages [objText] ~= objText) then
obj.Text = filteredMessages [objText];
elseif (not filteredMessages [objText]) then
obj.Text = '___';
local filtered = game:service 'Chat':FilterStringForBroadcast (objText, game:service 'Players'.localPlayer);
filteredMessages [objText] = filtered;
filteredMessages [filtered] = filtered;
obj.Text = filtered;
end;
end;
end;
end;
local newInstance = Instance.new;
Instance = {
new = function (class, parent)
local obj = newInstance (class, parent);
if (pcall (function()return obj.Text;end)) then
obj:getPropertyChangedSignal ('Parent'):connect (function () onPropertyChanged (obj) end);
obj:getPropertyChangedSignal ('Text'):connect (function() onPropertyChanged (obj) end);
end;
return obj;
end;
};
end;
--- THE ABOVE
--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"))
Model0 = Instance.new("Model")
Part1 = Instance.new("Part")
SpecialMesh2 = Instance.new("SpecialMesh")
Part3 = Instance.new("Part")
SpecialMesh4 = Instance.new("SpecialMesh")
Part5 = Instance.new("Part")
SpecialMesh6 = Instance.new("SpecialMesh")
Script7 = Instance.new("Script")
Model8 = Instance.new("Model")
Part9 = Instance.new("Part")
SurfaceGui10 = Instance.new("SurfaceGui")
TextLabel11 = Instance.new("TextLabel")
Part12 = Instance.new("Part")
Part13 = Instance.new("Part")
Part14 = Instance.new("Part")
Part15 = Instance.new("Part")
Part16 = Instance.new("Part")
Part17 = Instance.new("Part")
Part18 = Instance.new("Part")
Part19 = Instance.new("Part")
Part20 = Instance.new("Part")
Part21 = Instance.new("Part")
Part22 = Instance.new("Part")
Part23 = Instance.new("Part")
Part24 = Instance.new("Part")
Part25 = Instance.new("Part")
Script26 = Instance.new("Script")
Model0.Name = "Helmet"
Model0.Parent = mas
Model0.PrimaryPart = Part1
Part1.Name = "Center"
Part1.Parent = Model0
Part1.Transparency = 1
Part1.Rotation = Vector3.new(0.340000004, -1.46999991, 0.239999995)
Part1.CanCollide = false
Part1.FormFactor = Enum.FormFactor.Symmetric
Part1.Size = Vector3.new(2, 1, 1)
Part1.CFrame = CFrame.new(72.9180908, 6.41160107, -177.899567, 0.999660254, -0.0041671074, -0.0257321466, 0.00401700102, 0.999974668, -0.00588235958, 0.0257560052, 0.00577699533, 0.999651611)
Part1.TopSurface = Enum.SurfaceType.Smooth
Part1.Position = Vector3.new(72.9180908, 6.41160107, -177.899567)
Part1.Orientation = Vector3.new(0.340000004, -1.46999991, 0.229999989)
SpecialMesh2.Parent = Part1
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
Part3.Parent = Model0
Part3.Rotation = Vector3.new(4.1500001, -1.28999996, 0.429999977)
Part3.CanCollide = false
Part3.FormFactor = Enum.FormFactor.Symmetric
Part3.Size = Vector3.new(2, 1, 1)
Part3.CFrame = CFrame.new(72.9490585, 6.97505713, -177.815628, 0.999717772, -0.00752264773, -0.0225359276, 0.00587299839, 0.997358978, -0.0723927915, 0.0230209939, 0.0722400099, 0.997121572)
Part3.BottomSurface = Enum.SurfaceType.Smooth
Part3.TopSurface = Enum.SurfaceType.Smooth
Part3.Position = Vector3.new(72.9490585, 6.97505713, -177.815628)
Part3.Orientation = Vector3.new(4.1500001, -1.28999996, 0.340000004)
SpecialMesh4.Parent = Part3
SpecialMesh4.MeshId = "http://www.roblox.com/asset/?id=25648271"
SpecialMesh4.Scale = Vector3.new(1.29999995, 1.35000002, 1.29999995)
SpecialMesh4.TextureId = "http://www.roblox.com/asset/?id=28664001"
SpecialMesh4.MeshType = Enum.MeshType.FileMesh
SpecialMesh4.Scale = Vector3.new(1.29999995, 1.35000002, 1.29999995)
Part5.Parent = Model0
Part5.BrickColor = BrickColor.new("Really black")
Part5.Rotation = Vector3.new(0.839999974, -1.33999991, 1.26999998)
Part5.CanCollide = false
Part5.FormFactor = Enum.FormFactor.Plate
Part5.Size = Vector3.new(2, 1.20000005, 1)
Part5.CFrame = CFrame.new(72.9557266, 6.47859812, -177.850067, 0.999482214, -0.0220845398, -0.0234031118, 0.0217460059, 0.999656618, -0.0146224797, 0.023718005, 0.0141059821, 0.999619246)
Part5.BottomSurface = Enum.SurfaceType.Smooth
Part5.TopSurface = Enum.SurfaceType.Smooth
Part5.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
Part5.Position = Vector3.new(72.9557266, 6.47859812, -177.850067)
Part5.Orientation = Vector3.new(0.839999974, -1.33999991, 1.25)
Part5.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
SpecialMesh6.Parent = Part5
SpecialMesh6.MeshId = "http://www.roblox.com/asset/?id=1286427"
SpecialMesh6.Scale = Vector3.new(1.10000002, 1.10000002, 1.10000002)
SpecialMesh6.MeshType = Enum.MeshType.FileMesh
SpecialMesh6.Scale = Vector3.new(1.10000002, 1.10000002, 1.10000002)
Script7.Name = "qPerfectionWeld"
Script7.Parent = Model0
table.insert(cors,sandbox(Script7,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))
Model8.Name = "Vest"
Model8.Parent = mas
Model8.PrimaryPart = Part25
Part9.Name = "Sign"
Part9.Parent = Model8
Part9.Material = Enum.Material.Metal
Part9.BrickColor = BrickColor.new("Sand red")
Part9.Transparency = 1
Part9.Rotation = Vector3.new(-179.269989, 0.939999998, -179.25)
Part9.CanCollide = false
Part9.FormFactor = Enum.FormFactor.Symmetric
Part9.Size = Vector3.new(1.30000019, 0.550000012, 0.200000003)
Part9.CFrame = CFrame.new(72.9406586, 5.29043913, -177.003342, -0.999780118, 0.0131011065, 0.0163731799, 0.0133110015, 0.999829769, 0.0127768656, -0.0162030011, 0.0129919993, -0.99978435)
Part9.Color = Color3.new(0.584314, 0.47451, 0.466667)
Part9.Position = Vector3.new(72.9406586, 5.29043913, -177.003342)
Part9.Orientation = Vector3.new(-0.729999959, 179.059998, 0.75999999)
Part9.Color = Color3.new(0.584314, 0.47451, 0.466667)
SurfaceGui10.Parent = Part9
SurfaceGui10.CanvasSize = Vector2.new(200, 100)
TextLabel11.Parent = SurfaceGui10
TextLabel11.Transparency = 0
TextLabel11.Size = UDim2.new(1, 0, 1, 0)
TextLabel11.Text = "POLICE"
TextLabel11.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel11.BackgroundTransparency = 1
TextLabel11.Font = Enum.Font.SourceSansBold
TextLabel11.FontSize = Enum.FontSize.Size96
TextLabel11.TextColor3 = Color3.new(1, 1, 1)
TextLabel11.TextScaled = true
TextLabel11.TextStrokeTransparency = 0
TextLabel11.TextWrapped = true
Part12.Parent = Model8
Part12.Material = Enum.Material.Concrete
Part12.BrickColor = BrickColor.new("Black")
Part12.Rotation = Vector3.new(174.729996, 82.8499985, -173.940002)
Part12.CanCollide = false
Part12.FormFactor = Enum.FormFactor.Custom
Part12.Size = Vector3.new(0.200000003, 0.71999979, 0.449999988)
Part12.CFrame = CFrame.new(72.4569855, 4.71349096, -178.388519, -0.123689957, 0.0131369764, 0.992233932, 0.0145219946, 0.999829352, -0.0114272516, -0.99221462, 0.0129957823, -0.123859614)
Part12.BottomSurface = Enum.SurfaceType.Smooth
Part12.TopSurface = Enum.SurfaceType.Smooth
Part12.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part12.Position = Vector3.new(72.4569855, 4.71349096, -178.388519)
Part12.Orientation = Vector3.new(0.649999976, 97.1199951, 0.829999983)
Part12.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part13.Parent = Model8
Part13.Material = Enum.Material.Concrete
Part13.BrickColor = BrickColor.new("Black")
Part13.Rotation = Vector3.new(-179.269989, 0.939999998, -179.25)
Part13.CanCollide = false
Part13.FormFactor = Enum.FormFactor.Custom
Part13.Size = Vector3.new(0.290000021, 0.200000003, 1.19999945)
Part13.CFrame = CFrame.new(72.3412857, 5.96526623, -177.624023, -0.999779761, 0.0131309442, 0.0163746756, 0.0133409975, 0.999829352, 0.0127853658, -0.0162039958, 0.0130010033, -0.999784231)
Part13.BottomSurface = Enum.SurfaceType.Smooth
Part13.TopSurface = Enum.SurfaceType.Smooth
Part13.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part13.Position = Vector3.new(72.3412857, 5.96526623, -177.624023)
Part13.Orientation = Vector3.new(-0.729999959, 179.059998, 0.75999999)
Part13.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part14.Parent = Model8
Part14.Material = Enum.Material.Concrete
Part14.BrickColor = BrickColor.new("Black")
Part14.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part14.CanCollide = false
Part14.FormFactor = Enum.FormFactor.Custom
Part14.Size = Vector3.new(0.200000003, 1.2099992, 0.370000035)
Part14.CFrame = CFrame.new(72.1091156, 4.81766319, -177.202225, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part14.BottomSurface = Enum.SurfaceType.Smooth
Part14.TopSurface = Enum.SurfaceType.Smooth
Part14.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part14.Position = Vector3.new(72.1091156, 4.81766319, -177.202225)
Part14.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part14.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part15.Parent = Model8
Part15.Material = Enum.Material.Concrete
Part15.BrickColor = BrickColor.new("Black")
Part15.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part15.CanCollide = false
Part15.FormFactor = Enum.FormFactor.Custom
Part15.Size = Vector3.new(0.200000003, 1.2099992, 0.370000035)
Part15.CFrame = CFrame.new(73.7588272, 4.80563593, -177.175812, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part15.BottomSurface = Enum.SurfaceType.Smooth
Part15.TopSurface = Enum.SurfaceType.Smooth
Part15.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part15.Position = Vector3.new(73.7588272, 4.80563593, -177.175812)
Part15.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part15.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part16.Parent = Model8
Part16.Material = Enum.Material.Concrete
Part16.BrickColor = BrickColor.new("Black")
Part16.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part16.CanCollide = false
Part16.FormFactor = Enum.FormFactor.Custom
Part16.Size = Vector3.new(0.389999896, 0.919999599, 1.18999839)
Part16.CFrame = CFrame.new(72.0599594, 4.75864077, -177.613922, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part16.BottomSurface = Enum.SurfaceType.Smooth
Part16.TopSurface = Enum.SurfaceType.Smooth
Part16.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part16.Position = Vector3.new(72.0599594, 4.75864077, -177.613922)
Part16.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part16.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part17.Parent = Model8
Part17.Material = Enum.Material.Concrete
Part17.BrickColor = BrickColor.new("Black")
Part17.Rotation = Vector3.new(39.5, 88.7999954, -38.7599983)
Part17.CanCollide = false
Part17.FormFactor = Enum.FormFactor.Custom
Part17.Size = Vector3.new(0.359999925, 1.74999905, 1.47999918)
Part17.CFrame = CFrame.new(72.9529877, 5.08878517, -178.135315, 0.0163680073, 0.0131400097, 0.999779761, 0.0127740065, 0.999829352, -0.0133497929, -0.99978447, 0.0129897017, 0.0161973629)
Part17.BottomSurface = Enum.SurfaceType.Smooth
Part17.TopSurface = Enum.SurfaceType.Smooth
Part17.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part17.Position = Vector3.new(72.9529877, 5.08878517, -178.135315)
Part17.Orientation = Vector3.new(0.75999999, 89.0699997, 0.729999959)
Part17.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part18.Parent = Model8
Part18.Material = Enum.Material.Concrete
Part18.BrickColor = BrickColor.new("Black")
Part18.Rotation = Vector3.new(39.5, 88.7999954, -38.7599983)
Part18.CanCollide = false
Part18.FormFactor = Enum.FormFactor.Custom
Part18.Size = Vector3.new(0.359999806, 1.7899996, 1.47999918)
Part18.CFrame = CFrame.new(72.9363556, 5.08558512, -177.105606, 0.0163680073, 0.0131400097, 0.999779761, 0.0127740065, 0.999829352, -0.0133497929, -0.99978447, 0.0129897017, 0.0161973629)
Part18.BottomSurface = Enum.SurfaceType.Smooth
Part18.TopSurface = Enum.SurfaceType.Smooth
Part18.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part18.Position = Vector3.new(72.9363556, 5.08558512, -177.105606)
Part18.Orientation = Vector3.new(0.75999999, 89.0699997, 0.729999959)
Part18.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part19.Parent = Model8
Part19.Material = Enum.Material.Concrete
Part19.BrickColor = BrickColor.new("Black")
Part19.Rotation = Vector3.new(-179.269989, 0.939999998, -179.25)
Part19.CanCollide = false
Part19.FormFactor = Enum.FormFactor.Custom
Part19.Size = Vector3.new(0.290000021, 0.200000003, 1.19999945)
Part19.CFrame = CFrame.new(73.5408936, 5.93928385, -177.604767, -0.999779761, 0.0131309442, 0.0163746756, 0.0133409975, 0.999829352, 0.0127853658, -0.0162039958, 0.0130010033, -0.999784231)
Part19.BottomSurface = Enum.SurfaceType.Smooth
Part19.TopSurface = Enum.SurfaceType.Smooth
Part19.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part19.Position = Vector3.new(73.5408936, 5.93928385, -177.604767)
Part19.Orientation = Vector3.new(-0.729999959, 179.059998, 0.75999999)
Part19.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part20.Parent = Model8
Part20.Material = Enum.Material.Concrete
Part20.BrickColor = BrickColor.new("Black")
Part20.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part20.CanCollide = false
Part20.FormFactor = Enum.FormFactor.Custom
Part20.Size = Vector3.new(0.200000003, 1.2099992, 0.370000035)
Part20.CFrame = CFrame.new(72.1244736, 4.82962418, -178.142212, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part20.BottomSurface = Enum.SurfaceType.Smooth
Part20.TopSurface = Enum.SurfaceType.Smooth
Part20.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part20.Position = Vector3.new(72.1244736, 4.82962418, -178.142212)
Part20.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part20.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part21.Parent = Model8
Part21.Material = Enum.Material.Concrete
Part21.BrickColor = BrickColor.new("Black")
Part21.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part21.CanCollide = false
Part21.FormFactor = Enum.FormFactor.Custom
Part21.Size = Vector3.new(0.389999896, 0.919999599, 1.18999839)
Part21.CFrame = CFrame.new(73.7796783, 4.74567795, -177.585907, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part21.BottomSurface = Enum.SurfaceType.Smooth
Part21.TopSurface = Enum.SurfaceType.Smooth
Part21.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part21.Position = Vector3.new(73.7796783, 4.74567795, -177.585907)
Part21.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part21.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part22.Parent = Model8
Part22.Material = Enum.Material.Concrete
Part22.BrickColor = BrickColor.new("Black")
Part22.Rotation = Vector3.new(0.729999959, -0.939999998, -0.75)
Part22.CanCollide = false
Part22.FormFactor = Enum.FormFactor.Custom
Part22.Size = Vector3.new(0.200000003, 1.2099992, 0.370000035)
Part22.CFrame = CFrame.new(73.7241669, 4.80833578, -178.116241, 0.999779761, 0.0131310252, -0.0163746085, -0.0133409975, 0.999829352, -0.0127803665, 0.0162039958, 0.0129960049, 0.999784231)
Part22.BottomSurface = Enum.SurfaceType.Smooth
Part22.TopSurface = Enum.SurfaceType.Smooth
Part22.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part22.Position = Vector3.new(73.7241669, 4.80833578, -178.116241)
Part22.Orientation = Vector3.new(0.729999959, -0.939999998, -0.75999999)
Part22.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part23.Parent = Model8
Part23.Material = Enum.Material.Concrete
Part23.BrickColor = BrickColor.new("Black")
Part23.Rotation = Vector3.new(6.08999968, 81.9700012, -5.4000001)
Part23.CanCollide = false
Part23.FormFactor = Enum.FormFactor.Custom
Part23.Size = Vector3.new(0.200000003, 0.720000088, 0.449999988)
Part23.CFrame = CFrame.new(73.4771957, 4.71013212, -178.391571, 0.139059052, 0.0131340493, 0.990197003, 0.0110520059, 0.999829233, -0.0148139065, -0.990222454, 0.0130036715, 0.138890132)
Part23.BottomSurface = Enum.SurfaceType.Smooth
Part23.TopSurface = Enum.SurfaceType.Smooth
Part23.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part23.Position = Vector3.new(73.4771957, 4.71013212, -178.391571)
Part23.Orientation = Vector3.new(0.849999964, 82.0199966, 0.629999995)
Part23.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part24.Parent = Model8
Part24.Material = Enum.Material.Concrete
Part24.BrickColor = BrickColor.new("Black")
Part24.Rotation = Vector3.new(39.5, 88.7999954, -38.7599983)
Part24.CanCollide = false
Part24.FormFactor = Enum.FormFactor.Custom
Part24.Size = Vector3.new(0.200000003, 0.729999781, 0.449999988)
Part24.CFrame = CFrame.new(72.9676437, 4.71220207, -178.419983, 0.0163680073, 0.0131400097, 0.999779761, 0.0127740065, 0.999829352, -0.0133497929, -0.99978447, 0.0129897017, 0.0161973629)
Part24.BottomSurface = Enum.SurfaceType.Smooth
Part24.TopSurface = Enum.SurfaceType.Smooth
Part24.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part24.Position = Vector3.new(72.9676437, 4.71220207, -178.419983)
Part24.Orientation = Vector3.new(0.75999999, 89.0699997, 0.729999959)
Part24.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part25.Name = "Center"
Part25.Parent = Model8
Part25.Transparency = 1
Part25.Rotation = Vector3.new(0.0599999987, -1.02999997, -0.569999993)
Part25.CanCollide = false
Part25.FormFactor = Enum.FormFactor.Symmetric
Part25.Size = Vector3.new(2, 2, 1)
Part25.CFrame = CFrame.new(72.9311523, 4.96114111, -177.610779, 0.999788582, 0.00987272803, -0.0180385765, -0.00989200547, 0.999950647, -0.000979764038, 0.0180280115, 0.00115799461, 0.999836862)
Part25.Position = Vector3.new(72.9311523, 4.96114111, -177.610779)
Part25.Orientation = Vector3.new(0.0599999987, -1.02999997, -0.569999993)
Script26.Name = "qPerfectionWeld"
Script26.Parent = Model8
table.insert(cors,sandbox(Script26,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))
delay(0.3, function()
Part25.CFrame = game:GetService("Players").LocalPlayer.Character.Torso.CFrame
weldBetween(game:GetService("Players").LocalPlayer.Character.Torso, Part25)
Part1.CFrame = game:GetService("Players").LocalPlayer.Character.Head.CFrame
weldBetween(game:GetService("Players").LocalPlayer.Character.Head, Part1)
for i,v in pairs(game:GetService("Players").LocalPlayer.Character:GetChildren()) do
if v:IsA("Accessory") or v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") or v:IsA("CharacterMesh") then
v:Destroy()
end
end
shirt = Instance.new("Shirt", game:GetService("Players").LocalPlayer.Character)
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=104018587"
pants = Instance.new("Pants", game:GetService("Players").LocalPlayer.Character)
pants.PantsTemplate = "http://www.roblox.com/asset/?id=104018712"
if game:GetService("Players").LocalPlayer.Character:FindFirstChild("Body Colors") then
game:GetService("Players").LocalPlayer.Character:FindFirstChild("Body Colors").HeadColor = BrickColor.new("Pastel yellow")
end
end)
for i,v in pairs(mas:GetChildren()) do
v.Parent = game:GetService("Players").LocalPlayer.Character
pcall(function() v:MakeJoints() end)
end
mas:Destroy()
for i,v in pairs(cors) do
spawn(function()
pcall(v)
end)
end
--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")
ScreenGui1 = Instance.new("ScreenGui")
Frame2 = Instance.new("Frame")
Frame3 = Instance.new("Frame")
Frame4 = Instance.new("Frame")
Frame5 = Instance.new("Frame")
Frame6 = Instance.new("Frame")
ImageLabel7 = Instance.new("ImageLabel")
TextLabel8 = Instance.new("TextLabel")
Frame9 = Instance.new("Frame")
TextLabel10 = Instance.new("TextLabel")
TextLabel11 = Instance.new("TextLabel")
TextLabel12 = Instance.new("TextLabel")
LocalScript13 = Instance.new("LocalScript")
Animation14 = Instance.new("Animation")
Animation15 = Instance.new("Animation")
Animation16 = Instance.new("Animation")
LocalScript17 = Instance.new("LocalScript")
Part18 = Instance.new("Part")
SpecialMesh19 = Instance.new("SpecialMesh")
Sound20 = Instance.new("Sound")
Fire21 = Instance.new("Fire")
SpotLight22 = Instance.new("SpotLight")
Sound23 = Instance.new("Sound")
Sound24 = Instance.new("Sound")
Tool0.Name = "M16A4"
Tool0.Parent = mas
Tool0.GripForward = Vector3.new(-0.557080328, 0.830272019, 0.0176041722)
Tool0.GripPos = Vector3.new(0.522869527, 0.728810668, -0.409638792)
Tool0.GripRight = Vector3.new(0.830048621, 0.556014359, 0.0432098135)
Tool0.GripUp = Vector3.new(-0.0260877237, -0.0386836678, 0.998910964)
Tool0.CanBeDropped = false
ScreenGui1.Name = "WeaponHud"
ScreenGui1.Parent = Tool0
Frame2.Name = "Crosshair"
Frame2.Parent = ScreenGui1
Frame2.Transparency = 1
Frame2.Size = UDim2.new(0, 150, 0, 150)
Frame2.Position = UDim2.new(0, 500, 0, 500)
Frame2.Visible = false
Frame2.BackgroundColor3 = Color3.new(0, 1, 0)
Frame2.BackgroundTransparency = 1
Frame2.BorderSizePixel = 0
Frame3.Name = "TopFrame"
Frame3.Parent = Frame2
Frame3.Size = UDim2.new(0, 2, 0, 14)
Frame3.Position = UDim2.new(0, -1, -0.5, -7)
Frame3.BackgroundColor3 = Color3.new(0, 0, 0)
Frame3.BorderColor3 = Color3.new(0, 1, 0)
Frame4.Name = "BottomFrame"
Frame4.Parent = Frame2
Frame4.Size = UDim2.new(0, 2, 0, 14)
Frame4.Position = UDim2.new(0, -1, 0.5, -7)
Frame4.BackgroundColor3 = Color3.new(0, 0, 0)
Frame4.BorderColor3 = Color3.new(0, 1, 0)
Frame5.Name = "RightFrame"
Frame5.Parent = Frame2
Frame5.Size = UDim2.new(0, 14, 0, 2)
Frame5.Position = UDim2.new(0.5, -7, 0, -1)
Frame5.BackgroundColor3 = Color3.new(0, 0, 0)
Frame5.BorderColor3 = Color3.new(0, 1, 0)
Frame6.Name = "LeftFrame"
Frame6.Parent = Frame2
Frame6.Size = UDim2.new(0, 14, 0, 2)
Frame6.Position = UDim2.new(-0.5, -7, 0, -1)
Frame6.BackgroundColor3 = Color3.new(0, 0, 0)
Frame6.BorderColor3 = Color3.new(0, 1, 0)
ImageLabel7.Name = "TargetHitImage"
ImageLabel7.Parent = Frame2
ImageLabel7.Transparency = 1
ImageLabel7.Size = UDim2.new(0, 50, 0, 50)
ImageLabel7.Position = UDim2.new(0, -25, 0, -25)
ImageLabel7.Visible = false
ImageLabel7.BackgroundTransparency = 1
ImageLabel7.BorderSizePixel = 0
ImageLabel7.Image = "http://www.roblox.com/asset/?id=69368028"
TextLabel8.Name = "ReloadingLabel"
TextLabel8.Parent = Frame2
TextLabel8.Transparency = 1
TextLabel8.Text = "Reloading"
TextLabel8.Position = UDim2.new(0, 20, 0, -20)
TextLabel8.Visible = false
TextLabel8.BackgroundTransparency = 1
TextLabel8.BorderSizePixel = 0
TextLabel8.Font = Enum.Font.ArialBold
TextLabel8.FontSize = Enum.FontSize.Size18
TextLabel8.TextColor3 = Color3.new(0, 0, 0)
TextLabel8.TextStrokeColor3 = Color3.new(0, 1, 0)
TextLabel8.TextStrokeTransparency = 0
TextLabel8.TextXAlignment = Enum.TextXAlignment.Left
TextLabel8.TextYAlignment = Enum.TextYAlignment.Bottom
Frame9.Name = "AmmoHud"
Frame9.Parent = ScreenGui1
Frame9.Transparency = 1
Frame9.Size = UDim2.new(0, 200, 0, 50)
Frame9.Position = UDim2.new(1, -265, 1, -60)
Frame9.BackgroundTransparency = 1
Frame9.BorderSizePixel = 0
TextLabel10.Name = "ForwardSlash"
TextLabel10.Parent = Frame9
TextLabel10.Transparency = 0
TextLabel10.Text = "/"
TextLabel10.Position = UDim2.new(0.5, 0, 0.5, 0)
TextLabel10.BackgroundTransparency = 1
TextLabel10.BorderSizePixel = 0
TextLabel10.Font = Enum.Font.Arial
TextLabel10.FontSize = Enum.FontSize.Size48
TextLabel10.TextColor3 = Color3.new(1, 1, 1)
TextLabel11.Name = "ClipAmmo"
TextLabel11.Parent = Frame9
TextLabel11.Transparency = 0
TextLabel11.Text = "54"
TextLabel11.Position = UDim2.new(0.449999988, 0, 0.5, 0)
TextLabel11.BackgroundTransparency = 1
TextLabel11.BorderSizePixel = 0
TextLabel11.Font = Enum.Font.Arial
TextLabel11.FontSize = Enum.FontSize.Size48
TextLabel11.TextColor3 = Color3.new(1, 1, 1)
TextLabel11.TextXAlignment = Enum.TextXAlignment.Right
TextLabel12.Name = "TotalAmmo"
TextLabel12.Parent = Frame9
TextLabel12.Transparency = 0
TextLabel12.Text = "180"
TextLabel12.Position = UDim2.new(0.550000012, 0, 0.5, 0)
TextLabel12.BackgroundTransparency = 1
TextLabel12.BorderSizePixel = 0
TextLabel12.Font = Enum.Font.Arial
TextLabel12.FontSize = Enum.FontSize.Size48
TextLabel12.TextColor3 = Color3.new(1, 1, 1)
TextLabel12.TextXAlignment = Enum.TextXAlignment.Left
LocalScript13.Name = "AssaultRifleScript"
LocalScript13.Parent = Tool0
table.insert(cors,sandbox(LocalScript13,function()
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does
local Damage = 27
local HeadMultiplier = 1.65
-- How many times per second the gun can fire
local FireRate = 0.095
-- The maximum distance the can can shoot, this value should never go above 1000
local Range = 400
-- In radians the minimum accuracy penalty
local MinSpread = 0.01
-- In radian the maximum accuracy penalty
local MaxSpread = 0.1
-- Number of bullets in a clip
local ClipSize = 30
-- DefaultValue for spare ammo
local SpareAmmo = 600
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect
local AimInaccuracyStepAmount = 0.0125
-- Time it takes to reload weapon
local ReloadTime = 2.5
----------------------------------------
-- Colors
local FriendlyReticleColor = Color3.new(0, 1, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 1, 1)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local LeftButtonDown
local Reloading = false
local IsShooting = false
-- Player specific convenience variables
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local IconURL = Tool.TextureId -- URL to the weapon icon asset
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = Workspace.Terrain.GetCell
function RayIgnoreCheck(hit, pos)
if hit then
if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
return true
elseif hit:IsA('Terrain') and pos then
local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
if cellPos then
local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
if cellMat and cellMat == Enum.CellMaterial.Water then
return true
end
end
end
end
return false
end
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateFlash()
Handle.Light.Enabled = true
delay(0.01, function()
Handle.Light.Enabled = false
end)
if FlashHolder then
if not flash then
flash = Instance.new('Fire', FlashHolder)
flash.Color = Color3.new(1, 140 / 255, 0)
flash.SecondaryColor = Color3.new(1, 0, 0)
flash.Heat = 0
flash.Size = 0.3
delay(0.02, function()
flash.Enabled = false
end)
else
flash.Enabled = true
delay(0.02, function()
flash.Enabled = false
end)
end
else
FlashHolder = Instance.new("Part", Tool)
FlashHolder.Transparency = 1
FlashHolder.CanCollide= false
FlashHolder.Size = Vector3.new(1, 1, 1)
FlashHolder.Position = Tool.Handle.Position
local Weld = Instance.new("ManualWeld")
Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Weld.Part0 = FlashHolder
Weld.Part1 = Tool.Handle
Weld.Parent = FlashHolder
end
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.2, 0.2, 0.2)
bullet.BrickColor = BrickColor.new("Really black")
bullet.Material = "Neon"
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
--[[local fire = Instance.new("Fire", bullet)
fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.Size = 1
fire.Heat = 0
DebrisService:AddItem(fire, 0.1)]]--
return bullet
end
local function weldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld;
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
local aniTrack = WaitForChild(Tool.Parent,"Humanoid"):LoadAnimation(Tool.Reload)
local torso=WaitForChild(Tool.Parent,'Left Arm')
local oldWeld
for _,i in pairs(WaitForChild(Tool.Parent,'Right Arm'):GetChildren()) do
if i:IsA('Weld') and i.Part1==Tool.Handle then
oldWeld=i
end
end
if not oldWeld then
print('What... no old weld!')
return
end
Handle.Reload:Play()
aniTrack:Play(0,1,2)
delay(0.35, function()
oldWeld.Part1=nil
ChestWeld= weldBetween(torso,Tool.Handle)
end)
wait(ReloadTime)
oldWeld.Part1=Tool.Handle
ChestWeld:Destroy()
ChestWeld=nil
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
end
Reloading = false
end
end
function OnFire()
if IsShooting or stance == true then return end
if MyHumanoid and MyHumanoid.Health > 0 then
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading and MyHumanoid and MyHumanoid.Health > 0 and stance == false do
RecoilTrack:Play()
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
TagHumanoid(hitHumanoid, MyPlayer)
if hitObject.Name == "Head" then
hitHumanoid:TakeDamage(Damage * HeadMultiplier)
else
hitHumanoid:TakeDamage(Damage)
end
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
IsShooting = false
if AmmoInClip == 0 then
Handle.Empty:Play()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function safety()
if stance == false then
stance = true
Tool.Enabled = false
passive:Play()
else
stance = false
Tool.Enabled = true
if passive then
passive:Stop()
end
end
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
if string.lower(key) == 'q' then
safety()
end
end
function OnEquipped(mouse)
RecoilAnim = WaitForChild(Tool, 'FireAni')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
idle = MyHumanoid:LoadAnimation(Tool.idle)
idle:Play()
gunidleanim = Instance.new("Animation")
gunidleanim.AnimationId = "http://www.roblox.com/asset/?id=168086975"
passive = MyHumanoid:LoadAnimation(gunidleanim)
stance = false
Tool.Enabled = true
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=2966012"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
-- Unequip logic here
function OnUnequipped()
if idle then
idle:Stop()
end
if passive then
passive:Stop()
end
LeftButtonDown = false
Reloading = false
MyCharacter = nil
MyHumanoid = nil
MyTorso = nil
MyPlayer = nil
MyMouse = nil
if OnFireConnection then
OnFireConnection:disconnect()
end
if OnReloadConnection then
OnReloadConnection:disconnect()
end
if FlashHolder then
FlashHolder = nil
end
if WeaponGui then
WeaponGui.Parent = nil
WeaponGui = nil
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
local function SetReticleColor(color)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
if line:IsA('Frame') then
line.BorderColor3 = color
end
end
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
while true do
wait(0.033)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
SetReticleColor(NeutralReticleColor)
local target = MyMouse.Target
if target and target.Parent then
local player = PlayersService:GetPlayerFromCharacter(target.Parent)
if player then
if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
SetReticleColor(EnemyReticleColor)
else
SetReticleColor(FriendlyReticleColor)
end
end
end
end
if Spread and not IsShooting then
local currTime = time()
if currTime - LastSpreadUpdate > FireRate * 2 then
LastSpreadUpdate = currTime
Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
UpdateCrosshair(Spread, MyMouse)
end
end
end
end))
Animation14.Name = "FireAni"
Animation14.Parent = Tool0
Animation14.AnimationId = "rbxassetid://95390146"
Animation15.Name = "Reload"
Animation15.Parent = Tool0
Animation15.AnimationId = "http://www.roblox.com/Asset?ID=95384819"
Animation16.Name = "idle"
Animation16.Parent = Tool0
Animation16.AnimationId = "rbxassetid://95389685"
LocalScript17.Name = "CameraMoveDev"
LocalScript17.Parent = Tool0
table.insert(cors,sandbox(LocalScript17,function()
wait()
local RunService = game:GetService('RunService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
repeat wait() until player.Character
repeat wait() until player.Character:FindFirstChild("Humanoid")
repeat wait() until player.Character:FindFirstChild("Torso")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
torso = character.Torso
keyhold = false
--player.CameraMinZoomDistance = 0.5
lighting = true
haslight = false
mouse.KeyDown:connect(function(key)
if key == "f" then
game:GetService("Chat"):Chat(player.Character.Head, "FBI OPEN UP", Enum.ChatColor.Red)
snd = Instance.new("Sound", player.Character.Head)
snd.SoundId = "http://www.roblox.com/asset/?id=1545981804"
snd.EmitterSize = 50
snd.Volume = 10
snd:Play()
delay(0.75, function()
game.Debris:AddItem(snd, snd.TimeLength)
end)
end
end)
mouse.TargetFilter = nil
--humanoid.JumpPower = 0
maxcount = 100
runcount = maxcount
function populateparts(mdl)
if mdl:IsA("BasePart") then
table.insert(parts,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populateparts(mdl2)
end
end
function weldBetween(a, b)
--Make a new Weld and Parent it to a.
weld = Instance.new("ManualWeld", a)
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Set the Part0 and Part1 properties respectively
weld.Part0 = a
weld.Part1 = b
--Return the reference to the weld so that you can change it later.
return weld
end
humanoid.Died:connect(function()
if armgroup then
armgroup:Destroy()
if cl then
cl:Destroy()
end
if cl2 then
cl2:Destroy()
end
end
end)
LocalObjects = {}
function SetLocalTransparency(Table)
for i, v in pairs(LocalObjects) do
if v.Object == Table.Object then
Table.Object.LocalTransparencyModifier = Table.OriginalTransparency
table.remove(LocalObjects, i)
end
end
if not Table.Transparency then
return
end
Table.OriginalTransparency = Table.Object.LocalTransparencyModifier
table.insert(LocalObjects, Table)
if ModifyTransparency then
ModifyTransparency:disconnect()
end
ModifyTransparency = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
local function SetupJoints()
if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
return -- TODO: Make tracking compatible with R15
end
torso = character:FindFirstChild("Torso")
Neck = torso.Neck
OldNeckC0 = Neck.C0
OldNeckC1 = Neck.C1
Shoulder = torso['Right Shoulder']
Shoulder2 = torso['Left Shoulder']
OldShoulderC0 = Shoulder.C0
OldShoulderC1 = Shoulder.C1
OldShoulder2C0 = Shoulder2.C0
OldShoulder2C1 = Shoulder2.C1
end
local function visual()
if Tool then
if Tool:FindFirstChild("GetKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.5
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetKill:Destroy()
end
if Tool:FindFirstChild("GetHeadKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.75
Color.TintColor = Color3.new(1, 0.9, 0.9)
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetHeadKill:Destroy()
end
end
--player.CameraMode = Enum.CameraMode.LockFirstPerson
end
SetupJoints()
game:GetService("RunService").RenderStepped:connect(function()
if character and humanoid.Health > 0 and script.Parent.Parent == character then
if character:FindFirstChildOfClass("Tool") and character:FindFirstChildOfClass("Tool") == script.Parent then
Tool = character:FindFirstChildOfClass("Tool")
visual()
else
Tool = nil
end
if Tool and Tool.Enabled == true then
character.Humanoid.AutoRotate = false
mouse.TargetFilter = game.Workspace
--if (game.Workspace.CurrentCamera.CoordinateFrame.p - game.Workspace.CurrentCamera.Focus.p).magnitude < 1 then
--game.Workspace.CurrentCamera.CameraSubject = character.Head
game.Workspace.CurrentCamera.Focus = character.Head.CFrame
--end
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
local toMouse = (mouse.Hit.p - character.Head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
character.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2,0)
character.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/-2,0)
if character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
character['Torso'].CFrame = CFrame.new(character['Torso'].Position, character['Torso'].Position + (Vector3.new(
mouse.Hit.x, character['Torso'].Position.Y, mouse.Hit.z)-character['Torso'].Position).unit)
end
else
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end
end
end)
script.Parent.Unequipped:connect(function()
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end)
end))
Part18.Name = "Handle"
Part18.Parent = Tool0
Part18.BrickColor = BrickColor.new("Black")
Part18.Rotation = Vector3.new(-90, 0, -90)
Part18.FormFactor = Enum.FormFactor.Custom
Part18.Size = Vector3.new(0.400000006, 3.4000001, 0.800000012)
Part18.CFrame = CFrame.new(33.7200012, 9.61999989, 41.6899986, 0, 1, 0, 0, 0, 1, 1, 0, 0)
Part18.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part18.Position = Vector3.new(33.7200012, 9.61999989, 41.6899986)
Part18.Orientation = Vector3.new(-90, -90, 0)
Part18.Color = Color3.new(0.105882, 0.164706, 0.207843)
SpecialMesh19.Parent = Part18
SpecialMesh19.MeshId = "http://www.roblox.com/asset/?id=72012671"
SpecialMesh19.Scale = Vector3.new(1.14999998, 1.14999998, 1.14999998)
SpecialMesh19.TextureId = "http://www.roblox.com/asset/?id=72012605"
SpecialMesh19.VertexColor = Vector3.new(2, 2, 2)
SpecialMesh19.MeshType = Enum.MeshType.FileMesh
SpecialMesh19.Scale = Vector3.new(1.14999998, 1.14999998, 1.14999998)
Sound20.Name = "FireSound"
Sound20.Parent = Part18
Sound20.SoundId = "rbxassetid://151997297"
Sound20.Volume = 1
Fire21.Parent = Part18
Fire21.Size = 2
Fire21.Color = Color3.new(0.145098, 0.145098, 0.164706)
Fire21.Enabled = false
Fire21.Heat = 0
Fire21.SecondaryColor = Color3.new(0, 0, 0)
Fire21.Color = Color3.new(0.145098, 0.145098, 0.164706)
SpotLight22.Name = "Light"
SpotLight22.Parent = Part18
SpotLight22.Color = Color3.new(1, 1, 0.498039)
SpotLight22.Enabled = false
SpotLight22.Brightness = 50
SpotLight22.Range = 18
SpotLight22.Angle = 120
SpotLight22.Face = Enum.NormalId.Top
SpotLight22.Color = Color3.new(1, 1, 0.498039)
Sound23.Name = "Reload"
Sound23.Parent = Part18
Sound23.SoundId = "http://www.roblox.com/asset/?id=95309699"
Sound23.Volume = 1
Sound24.Name = "Empty"
Sound24.Parent = Part18
Sound24.SoundId = "rbxassetid://240785604"
Sound24.Volume = 1
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
--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")
Part1p = Instance.new("Part")
SpecialMesh2 = Instance.new("SpecialMesh")
LocalScript3 = Instance.new("LocalScript")
Tool4 = Instance.new("Tool")
ScreenGui5 = Instance.new("ScreenGui")
Frame6 = Instance.new("Frame")
Frame7 = Instance.new("Frame")
Frame8 = Instance.new("Frame")
Frame9 = Instance.new("Frame")
Frame10 = Instance.new("Frame")
ImageLabel11 = Instance.new("ImageLabel")
TextLabel12 = Instance.new("TextLabel")
Frame13 = Instance.new("Frame")
TextLabel14 = Instance.new("TextLabel")
TextLabel15 = Instance.new("TextLabel")
TextLabel16 = Instance.new("TextLabel")
LocalScript17 = Instance.new("LocalScript")
Animation18 = Instance.new("Animation")
LocalScript19 = Instance.new("LocalScript")
Part20 = Instance.new("Part")
SpecialMesh21 = Instance.new("SpecialMesh")
Sound22 = Instance.new("Sound")
Sound23 = Instance.new("Sound")
Sound24 = Instance.new("Sound")
Fire25 = Instance.new("Fire")
SpotLight26 = Instance.new("SpotLight")
Animation27 = Instance.new("Animation")
Animation28 = Instance.new("Animation")
Tool29 = Instance.new("Tool")
LocalScript30 = Instance.new("LocalScript")
Script31 = Instance.new("Script")
Part32 = Instance.new("Part")
CylinderMesh33 = Instance.new("CylinderMesh")
Weld34 = Instance.new("Weld")
Sound35 = Instance.new("Sound")
Sound36 = Instance.new("Sound")
Sound37 = Instance.new("Sound")
Sound38 = Instance.new("Sound")
Sound39 = Instance.new("Sound")
Part40 = Instance.new("Part")
CylinderMesh41 = Instance.new("CylinderMesh")
Weld42 = Instance.new("Weld")
Script43 = Instance.new("Script")
Part44 = Instance.new("Part")
CylinderMesh45 = Instance.new("CylinderMesh")
Weld46 = Instance.new("Weld")
Script47 = Instance.new("Script")
Part48 = Instance.new("Part")
CylinderMesh49 = Instance.new("CylinderMesh")
Script50 = Instance.new("Script")
BoolValue51 = Instance.new("BoolValue")
BoolValue52 = Instance.new("BoolValue")
BoolValue53 = Instance.new("BoolValue")
Script54 = Instance.new("Script")
LocalScript55 = Instance.new("LocalScript")
Animation56 = Instance.new("Animation")
Animation57 = Instance.new("Animation")
Animation58 = Instance.new("Animation")
Animation59 = Instance.new("Animation")
Animation60 = Instance.new("Animation")
Animation61 = Instance.new("Animation")
Tool62 = Instance.new("Tool")
Part63 = Instance.new("Part")
SpecialMesh64 = Instance.new("SpecialMesh")
Sound65 = Instance.new("Sound")
Sound66 = Instance.new("Sound")
LocalScript67 = Instance.new("LocalScript")
Script68 = Instance.new("Script")
Sound69 = Instance.new("Sound")
Sound70 = Instance.new("Sound")
Script71 = Instance.new("Script")
LocalScript72 = Instance.new("LocalScript")
Animation73 = Instance.new("Animation")
LocalScript74 = Instance.new("LocalScript")
Part75 = Instance.new("Part")
SpecialMesh76 = Instance.new("SpecialMesh")
Script77 = Instance.new("Script")
Script78 = Instance.new("Script")
LocalScript79 = Instance.new("LocalScript")
LocalScript80 = Instance.new("LocalScript")
Tool81 = Instance.new("Tool")
Part82 = Instance.new("Part")
BlockMesh83 = Instance.new("BlockMesh")
Part84 = Instance.new("Part")
BlockMesh85 = Instance.new("BlockMesh")
Script86 = Instance.new("Script")
LocalScript87 = Instance.new("LocalScript")
Part88 = Instance.new("Part")
CylinderMesh89 = Instance.new("CylinderMesh")
Part90 = Instance.new("Part")
BlockMesh91 = Instance.new("BlockMesh")
Part92 = Instance.new("Part")
SpecialMesh93 = Instance.new("SpecialMesh")
Part94 = Instance.new("Part")
BlockMesh95 = Instance.new("BlockMesh")
Part96 = Instance.new("Part")
BlockMesh97 = Instance.new("BlockMesh")
Part98 = Instance.new("Part")
BlockMesh99 = Instance.new("BlockMesh")
Part100 = Instance.new("Part")
BlockMesh101 = Instance.new("BlockMesh")
Part102 = Instance.new("Part")
SpecialMesh103 = Instance.new("SpecialMesh")
Part104 = Instance.new("Part")
BlockMesh105 = Instance.new("BlockMesh")
Part106 = Instance.new("Part")
BlockMesh107 = Instance.new("BlockMesh")
Part108 = Instance.new("Part")
BlockMesh109 = Instance.new("BlockMesh")
Part110 = Instance.new("Part")
BlockMesh111 = Instance.new("BlockMesh")
Part112 = Instance.new("Part")
BlockMesh113 = Instance.new("BlockMesh")
Part114 = Instance.new("Part")
BlockMesh115 = Instance.new("BlockMesh")
Part116 = Instance.new("Part")
SpecialMesh117 = Instance.new("SpecialMesh")
Part118 = Instance.new("Part")
BlockMesh119 = Instance.new("BlockMesh")
Part120 = Instance.new("Part")
BlockMesh121 = Instance.new("BlockMesh")
Part122 = Instance.new("Part")
BlockMesh123 = Instance.new("BlockMesh")
Part124 = Instance.new("Part")
BlockMesh125 = Instance.new("BlockMesh")
Part126 = Instance.new("Part")
BlockMesh127 = Instance.new("BlockMesh")
Decal128 = Instance.new("Decal")
Part129 = Instance.new("Part")
BlockMesh130 = Instance.new("BlockMesh")
Part131 = Instance.new("Part")
CylinderMesh132 = Instance.new("CylinderMesh")
Part133 = Instance.new("Part")
BlockMesh134 = Instance.new("BlockMesh")
Part135 = Instance.new("Part")
BlockMesh136 = Instance.new("BlockMesh")
Part137 = Instance.new("Part")
BlockMesh138 = Instance.new("BlockMesh")
Part139 = Instance.new("Part")
BlockMesh140 = Instance.new("BlockMesh")
Part141 = Instance.new("Part")
BlockMesh142 = Instance.new("BlockMesh")
Part143 = Instance.new("Part")
BlockMesh144 = Instance.new("BlockMesh")
Part145 = Instance.new("Part")
BlockMesh146 = Instance.new("BlockMesh")
Part147 = Instance.new("Part")
BlockMesh148 = Instance.new("BlockMesh")
Part149 = Instance.new("Part")
BlockMesh150 = Instance.new("BlockMesh")
Part151 = Instance.new("Part")
BlockMesh152 = Instance.new("BlockMesh")
Part153 = Instance.new("Part")
BlockMesh154 = Instance.new("BlockMesh")
Part155 = Instance.new("Part")
BlockMesh156 = Instance.new("BlockMesh")
Part157 = Instance.new("Part")
BlockMesh158 = Instance.new("BlockMesh")
Part159 = Instance.new("Part")
SpecialMesh160 = Instance.new("SpecialMesh")
Part161 = Instance.new("Part")
BlockMesh162 = Instance.new("BlockMesh")
Part163 = Instance.new("Part")
BlockMesh164 = Instance.new("BlockMesh")
Part165 = Instance.new("Part")
BlockMesh166 = Instance.new("BlockMesh")
Part167 = Instance.new("Part")
BlockMesh168 = Instance.new("BlockMesh")
Part169 = Instance.new("Part")
BlockMesh170 = Instance.new("BlockMesh")
Part171 = Instance.new("Part")
BlockMesh172 = Instance.new("BlockMesh")
Sound173 = Instance.new("Sound")
Sound174 = Instance.new("Sound")
Sound175 = Instance.new("Sound")
Tool4.Parent = mas
Tool0.Name = "Handcuffs"
Tool0.Parent = mas
Tool0.GripForward = Vector3.new(-0.77155745, 0.462976098, 0.43629396)
Tool0.GripPos = Vector3.new(0.899999976, 0.5, 0.400000006)
Tool0.GripRight = Vector3.new(0.632408082, 0.63257581, 0.447110623)
Tool0.GripUp = Vector3.new(0.0689874813, -0.620887339, 0.780858338)
Tool0.CanBeDropped = false
Part1p.Name = "Handle"
Part1p.Parent = Tool0
Part1p.FormFactor = Enum.FormFactor.Custom
Part1p.Size = Vector3.new(2, 2, 2)
Part1p.CFrame = CFrame.new(0.880016029, 2.99999905, 6.64000177, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Part1p.Position = Vector3.new(0.880016029, 2.99999905, 6.64000177)
SpecialMesh2.Parent = Part1p
SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=88046657"
SpecialMesh2.Scale = Vector3.new(2, 2, 2)
SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=88046679"
SpecialMesh2.MeshType = Enum.MeshType.FileMesh
SpecialMesh2.Scale = Vector3.new(2, 2, 2)
LocalScript3.Parent = Tool0
table.insert(cors,sandbox(LocalScript3,function()
script.Parent.Equipped:connect(function(m)
m.Button1Down:connect(function()
if m.Target~=nil then
print(m.Target:GetFullName())
p=nil
_,p=pcall(function() return game.Players[m.Target.Parent.Name] end)
print(p)
print(m.Target.Parent.Name)
if p~=nil then
local detained=p
coroutine.wrap(function()
local c=p
while p==c do wait() pcall(function()
p.Character.Torso.Anchored,p.Character.Torso.CFrame=true,game.Players.LocalPlayer.Character.Torso.CFrame*CFrame.new(0,0,-2.5)
end) end
print('END OF DETAIN LOOP')
pcall(function() c.Character.Torso.Anchored=false end)
end)()
else print('no p') end
end
end)
end)
local Tool = script.Parent
local Handle = Tool.Handle
local On = false
Weld = function(Part0, Part1, C0, C1)
local Weld = Instance.new("Weld")
Weld.Part0 = Part0
Weld.Part1 = Part1
Weld.C0 = C0 or CFrame.new(0, 0, 0)
Weld.C1 = C1 or CFrame.new(0, 0, 0)
Weld.Parent = Part0
return Weld
end
local rWeld, lWeld
local LeftArm, RightArm, Torso, rShoulder, lShoulder
Tool.Equipped:connect(function()
On = true
LeftArm = Tool.Parent:FindFirstChild("Left Arm")
RightArm = Tool.Parent:FindFirstChild("Right Arm")
Torso = Tool.Parent:FindFirstChild("Torso")
rShoulder = Torso:FindFirstChild("Right Shoulder")
lShoulder = Torso:FindFirstChild("Left Shoulder")
rShoulder.Part1 = nil
lShoulder.Part1 = nil
rWeld = Weld(Torso, RightArm, CFrame.new(1.2,0.2,-0.5) * CFrame.Angles(math.pi/3,0,-math.pi/20))
lWeld = Weld(Torso, LeftArm, CFrame.new(-1.2,0.2,-0.5) * CFrame.Angles(math.pi/3,0,math.pi/20))
end)
Tool.Unequipped:connect(function()
On = false
rShoulder.Part1 = RightArm
lShoulder.Part1 = LeftArm
rWeld:Destroy()
lWeld:Destroy()
end)
end))
Tool4.Name = "Pistol"
Tool4.GripForward = Vector3.new(-0.557080388, 0.830272019, 0.0176041797)
Tool4.GripPos = Vector3.new(0.104686491, -0.334273487, -0.409638941)
Tool4.GripRight = Vector3.new(0.8300488, 0.556014478, 0.043209821)
Tool4.GripUp = Vector3.new(-0.0260877237, -0.0386836678, 0.998910964)
Tool4.CanBeDropped = false
ScreenGui5.Name = "WeaponHud"
ScreenGui5.Parent = Tool4
Frame6.Name = "Crosshair"
Frame6.Parent = ScreenGui5
Frame6.Transparency = 1
Frame6.Size = UDim2.new(0, 150, 0, 150)
Frame6.Position = UDim2.new(0, 500, 0, 500)
Frame6.Visible = false
Frame6.BackgroundColor3 = Color3.new(0, 1, 0)
Frame6.BackgroundTransparency = 1
Frame6.BorderSizePixel = 0
Frame7.Name = "TopFrame"
Frame7.Parent = Frame6
Frame7.Size = UDim2.new(0, 2, 0, 14)
Frame7.Position = UDim2.new(0, -1, -0.5, -7)
Frame7.BackgroundColor3 = Color3.new(0, 0, 0)
Frame7.BorderColor3 = Color3.new(0, 1, 0)
Frame8.Name = "BottomFrame"
Frame8.Parent = Frame6
Frame8.Size = UDim2.new(0, 2, 0, 14)
Frame8.Position = UDim2.new(0, -1, 0.5, -7)
Frame8.BackgroundColor3 = Color3.new(0, 0, 0)
Frame8.BorderColor3 = Color3.new(0, 1, 0)
Frame9.Name = "RightFrame"
Frame9.Parent = Frame6
Frame9.Size = UDim2.new(0, 14, 0, 2)
Frame9.Position = UDim2.new(0.5, -7, 0, -1)
Frame9.BackgroundColor3 = Color3.new(0, 0, 0)
Frame9.BorderColor3 = Color3.new(0, 1, 0)
Frame10.Name = "LeftFrame"
Frame10.Parent = Frame6
Frame10.Size = UDim2.new(0, 14, 0, 2)
Frame10.Position = UDim2.new(-0.5, -7, 0, -1)
Frame10.BackgroundColor3 = Color3.new(0, 0, 0)
Frame10.BorderColor3 = Color3.new(0, 1, 0)
ImageLabel11.Name = "TargetHitImage"
ImageLabel11.Parent = Frame6
ImageLabel11.Transparency = 1
ImageLabel11.Size = UDim2.new(0, 50, 0, 50)
ImageLabel11.Position = UDim2.new(0, -25, 0, -25)
ImageLabel11.Visible = false
ImageLabel11.BackgroundTransparency = 1
ImageLabel11.BorderSizePixel = 0
ImageLabel11.Image = "http://www.roblox.com/asset/?id=69368028"
TextLabel12.Name = "ReloadingLabel"
TextLabel12.Parent = Frame6
TextLabel12.Transparency = 1
TextLabel12.Text = "Reloading"
TextLabel12.Position = UDim2.new(0, 20, 0, -20)
TextLabel12.Visible = false
TextLabel12.BackgroundTransparency = 1
TextLabel12.BorderSizePixel = 0
TextLabel12.Font = Enum.Font.ArialBold
TextLabel12.FontSize = Enum.FontSize.Size18
TextLabel12.TextColor3 = Color3.new(0, 0, 0)
TextLabel12.TextStrokeColor3 = Color3.new(0, 1, 0)
TextLabel12.TextStrokeTransparency = 0
TextLabel12.TextTransparency = 1
TextLabel12.TextXAlignment = Enum.TextXAlignment.Left
TextLabel12.TextYAlignment = Enum.TextYAlignment.Bottom
Frame13.Name = "AmmoHud"
Frame13.Parent = ScreenGui5
Frame13.Transparency = 1
Frame13.Size = UDim2.new(0, 200, 0, 50)
Frame13.Position = UDim2.new(1, -265, 1, -60)
Frame13.BackgroundTransparency = 1
Frame13.BorderSizePixel = 0
TextLabel14.Name = "ForwardSlash"
TextLabel14.Parent = Frame13
TextLabel14.Transparency = 0
TextLabel14.Text = "/"
TextLabel14.Position = UDim2.new(0.5, 0, 0.5, 0)
TextLabel14.BackgroundTransparency = 1
TextLabel14.BorderSizePixel = 0
TextLabel14.Font = Enum.Font.Arial
TextLabel14.FontSize = Enum.FontSize.Size48
TextLabel14.TextColor3 = Color3.new(1, 1, 1)
TextLabel15.Name = "ClipAmmo"
TextLabel15.Parent = Frame13
TextLabel15.Transparency = 0
TextLabel15.Text = "54"
TextLabel15.Position = UDim2.new(0.449999988, 0, 0.5, 0)
TextLabel15.BackgroundTransparency = 1
TextLabel15.BorderSizePixel = 0
TextLabel15.Font = Enum.Font.Arial
TextLabel15.FontSize = Enum.FontSize.Size48
TextLabel15.TextColor3 = Color3.new(1, 1, 1)
TextLabel15.TextXAlignment = Enum.TextXAlignment.Right
TextLabel16.Name = "TotalAmmo"
TextLabel16.Parent = Frame13
TextLabel16.Transparency = 0
TextLabel16.Text = "180"
TextLabel16.Position = UDim2.new(0.550000012, 0, 0.5, 0)
TextLabel16.BackgroundTransparency = 1
TextLabel16.BorderSizePixel = 0
TextLabel16.Font = Enum.Font.Arial
TextLabel16.FontSize = Enum.FontSize.Size48
TextLabel16.TextColor3 = Color3.new(1, 1, 1)
TextLabel16.TextXAlignment = Enum.TextXAlignment.Left
LocalScript17.Name = "AssaultRifleScript"
LocalScript17.Parent = Tool4
table.insert(cors,sandbox(LocalScript17,function()
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
----- MAGIC NUMBERS ABOUT THE TOOL -----
local Auto = false
-- How much damage a bullet does
local Damage = 65
local HeadMultiplier = 1.65
-- How many times per second the gun can fire
local FireRate = 0.15
-- The maximum distance the can can shoot, this value should never go above 1000
local Range = 400
-- In radians the minimum accuracy penalty
local MinSpread = 0.01
-- In radian the maximum accuracy penalty
local MaxSpread = 0.075
-- Number of bullets in a clip
local ClipSize = 12
-- DefaultValue for spare ammo
local SpareAmmo = 240
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect
local AimInaccuracyStepAmount = 0.0125
-- Time it takes to reload weapon
local ReloadTime = 2.5
----------------------------------------
-- Colors
local FriendlyReticleColor = Color3.new(0, 1, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 1, 1)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local LeftButtonDown
local Reloading = false
local IsShooting = false
-- Player specific convenience variables
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local IconURL = Tool.TextureId -- URL to the weapon icon asset
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = Workspace.Terrain.GetCell
function RayIgnoreCheck(hit, pos)
if hit then
if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
return true
elseif hit:IsA('Terrain') and pos then
local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
if cellPos then
local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
if cellMat and cellMat == Enum.CellMaterial.Water then
return true
end
end
end
end
return false
end
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateFlash()
Handle.Light.Enabled = true
delay(0.01, function()
Handle.Light.Enabled = false
end)
if FlashHolder then
if not flash then
flash = Instance.new('Fire', FlashHolder)
flash.Color = Color3.new(1, 140 / 255, 0)
flash.SecondaryColor = Color3.new(1, 0, 0)
flash.Heat = 0
flash.Size = 0.3
delay(0.02, function()
flash.Enabled = false
end)
else
flash.Enabled = true
delay(0.02, function()
flash.Enabled = false
end)
end
else
FlashHolder = Instance.new("Part", Tool)
FlashHolder.Transparency = 1
FlashHolder.CanCollide= false
FlashHolder.Size = Vector3.new(1, 1, 1)
FlashHolder.Position = Tool.Handle.Position
local Weld = Instance.new("ManualWeld")
Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Weld.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Weld.Part0 = FlashHolder
Weld.Part1 = Tool.Handle
Weld.Parent = FlashHolder
end
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.2, 0.2, 0.2)
bullet.BrickColor = BrickColor.new("Really black")
bullet.Material = "Neon"
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
--[[local fire = Instance.new("Fire", bullet)
fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.Size = 1
fire.Heat = 0
DebrisService:AddItem(fire, 0.1)]]--
return bullet
end
local function weldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld;
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
local aniTrack = WaitForChild(Tool.Parent,"Humanoid"):LoadAnimation(Tool.Reload)
local torso=WaitForChild(Tool.Parent,'Left Arm')
local oldWeld
for _,i in pairs(WaitForChild(Tool.Parent,'Right Arm'):GetChildren()) do
if i:IsA('Weld') and i.Part1==Tool.Handle then
oldWeld=i
end
end
if not oldWeld then
print('What... no old weld!')
return
end
Handle.Reload:Play()
aniTrack:Play(0,1,2)
delay(0.35, function()
oldWeld.Part1=nil
ChestWeld= weldBetween(torso,Tool.Handle)
end)
wait(ReloadTime)
oldWeld.Part1=Tool.Handle
ChestWeld:Destroy()
ChestWeld=nil
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
end
Reloading = false
end
end
function OnFire()
if IsShooting or stance == true then return end
if MyHumanoid and MyHumanoid.Health > 0 then
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading and MyHumanoid and MyHumanoid.Health > 0 and stance == false do
if Auto == false then
LeftButtonDown = false
end
RecoilTrack:Play()
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
TagHumanoid(hitHumanoid, MyPlayer)
if hitObject.Name == "Head" then
hitHumanoid:TakeDamage(Damage * HeadMultiplier)
else
hitHumanoid:TakeDamage(Damage)
end
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
IsShooting = false
if AmmoInClip == 0 then
Handle.Empty:Play()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function safety()
if stance == false then
stance = true
Tool.Enabled = false
passive:Play()
else
stance = false
Tool.Enabled = true
if passive then
passive:Stop()
end
end
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
if string.lower(key) == 'q' then
safety()
end
end
function OnEquipped(mouse)
RecoilAnim = WaitForChild(Tool, 'FireAni')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
idle = MyHumanoid:LoadAnimation(Tool.idle)
idle:Play()
gunidleanim = Instance.new("Animation")
gunidleanim.AnimationId = "http://www.roblox.com/asset/?id=168086975"
passive = MyHumanoid:LoadAnimation(gunidleanim)
stance = false
Tool.Enabled = true
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=2966012"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
-- Unequip logic here
function OnUnequipped()
if idle then
idle:Stop()
end
if passive then
passive:Stop()
end
LeftButtonDown = false
Reloading = false
MyCharacter = nil
MyHumanoid = nil
MyTorso = nil
MyPlayer = nil
MyMouse = nil
if OnFireConnection then
OnFireConnection:disconnect()
end
if OnReloadConnection then
OnReloadConnection:disconnect()
end
if FlashHolder then
FlashHolder = nil
end
if WeaponGui then
WeaponGui.Parent = nil
WeaponGui = nil
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
local function SetReticleColor(color)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
if line:IsA('Frame') then
line.BorderColor3 = color
end
end
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
while true do
wait(0.033)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
SetReticleColor(NeutralReticleColor)
local target = MyMouse.Target
if target and target.Parent then
local player = PlayersService:GetPlayerFromCharacter(target.Parent)
if player then
if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
SetReticleColor(EnemyReticleColor)
else
SetReticleColor(FriendlyReticleColor)
end
end
end
end
if Spread and not IsShooting then
local currTime = time()
if currTime - LastSpreadUpdate > FireRate * 2 then
LastSpreadUpdate = currTime
Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
UpdateCrosshair(Spread, MyMouse)
end
end
end
end))
Animation18.Name = "Reload"
Animation18.Parent = Tool4
Animation18.AnimationId = "http://www.roblox.com/Asset?ID=95384819"
LocalScript19.Name = "CameraMoveDev"
LocalScript19.Parent = Tool4
table.insert(cors,sandbox(LocalScript19,function()
local RunService = game:GetService('RunService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
repeat wait() until player.Character
repeat wait() until player.Character:FindFirstChild("Humanoid")
repeat wait() until player.Character:FindFirstChild("Torso")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
torso = character.Torso
keyhold = false
--player.CameraMinZoomDistance = 0.5
lighting = true
haslight = false
mouse.TargetFilter = nil
--humanoid.JumpPower = 0
maxcount = 100
runcount = maxcount
function populateparts(mdl)
if mdl:IsA("BasePart") then
table.insert(parts,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populateparts(mdl2)
end
end
function weldBetween(a, b)
--Make a new Weld and Parent it to a.
weld = Instance.new("ManualWeld", a)
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Set the Part0 and Part1 properties respectively
weld.Part0 = a
weld.Part1 = b
--Return the reference to the weld so that you can change it later.
return weld
end
humanoid.Died:connect(function()
if armgroup then
armgroup:Destroy()
if cl then
cl:Destroy()
end
if cl2 then
cl2:Destroy()
end
end
end)
LocalObjects = {}
function SetLocalTransparency(Table)
for i, v in pairs(LocalObjects) do
if v.Object == Table.Object then
Table.Object.LocalTransparencyModifier = Table.OriginalTransparency
table.remove(LocalObjects, i)
end
end
if not Table.Transparency then
return
end
Table.OriginalTransparency = Table.Object.LocalTransparencyModifier
table.insert(LocalObjects, Table)
if ModifyTransparency then
ModifyTransparency:disconnect()
end
ModifyTransparency = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
local function SetupJoints()
if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
return -- TODO: Make tracking compatible with R15
end
torso = character:FindFirstChild("Torso")
Neck = torso.Neck
OldNeckC0 = Neck.C0
OldNeckC1 = Neck.C1
Shoulder = torso['Right Shoulder']
Shoulder2 = torso['Left Shoulder']
OldShoulderC0 = Shoulder.C0
OldShoulderC1 = Shoulder.C1
OldShoulder2C0 = Shoulder2.C0
OldShoulder2C1 = Shoulder2.C1
end
local function visual()
if Tool then
if Tool:FindFirstChild("GetKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.5
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetKill:Destroy()
end
if Tool:FindFirstChild("GetHeadKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.75
Color.TintColor = Color3.new(1, 0.9, 0.9)
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetHeadKill:Destroy()
end
end
--player.CameraMode = Enum.CameraMode.LockFirstPerson
end
SetupJoints()
game:GetService("RunService").RenderStepped:connect(function()
if character and humanoid.Health > 0 and script.Parent.Parent == character then
if character:FindFirstChildOfClass("Tool") and character:FindFirstChildOfClass("Tool") == script.Parent then
Tool = character:FindFirstChildOfClass("Tool")
visual()
else
Tool = nil
end
if Tool and Tool.Enabled == true then
character.Humanoid.AutoRotate = false
mouse.TargetFilter = game.Workspace
--if (game.Workspace.CurrentCamera.CoordinateFrame.p - game.Workspace.CurrentCamera.Focus.p).magnitude < 1 then
--game.Workspace.CurrentCamera.CameraSubject = character.Head
game.Workspace.CurrentCamera.Focus = character.Head.CFrame
--end
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
local toMouse = (mouse.Hit.p - character.Head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
character.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2,0)
character.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/-2,0)
if character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
character['Torso'].CFrame = CFrame.new(character['Torso'].Position, character['Torso'].Position + (Vector3.new(
mouse.Hit.x, character['Torso'].Position.Y, mouse.Hit.z)-character['Torso'].Position).unit)
end
else
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end
end
end)
script.Parent.Unequipped:connect(function()
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end)
end))
Part20.Name = "Handle"
Part20.Parent = Tool4
Part20.BrickColor = BrickColor.new("Pastel yellow")
Part20.Rotation = Vector3.new(0, -89.9399948, 0)
Part20.CanCollide = false
Part20.FormFactor = Enum.FormFactor.Custom
Part20.Size = Vector3.new(0.200000003, 1.20000005, 0.699999988)
Part20.CFrame = CFrame.new(70.1900024, 2.50001621, 26.3299923, 0, 0, -0.999999523, -0.999999523, 0, 0, 0, 1, 0)
Part20.BottomSurface = Enum.SurfaceType.Smooth
Part20.TopSurface = Enum.SurfaceType.Smooth
Part20.Color = Color3.new(1, 1, 0.8)
Part20.Position = Vector3.new(70.1900024, 2.50001621, 26.3299923)
Part20.Orientation = Vector3.new(0, -90, -90)
Part20.Color = Color3.new(1, 1, 0.8)
SpecialMesh21.Parent = Part20
SpecialMesh21.MeshId = "http://www.roblox.com/asset/?id=72012879"
SpecialMesh21.Scale = Vector3.new(1.25, 1.25, 1.25)
SpecialMesh21.TextureId = "http://www.roblox.com/asset/?id=72012859"
SpecialMesh21.VertexColor = Vector3.new(2, 2, 2)
SpecialMesh21.MeshType = Enum.MeshType.FileMesh
SpecialMesh21.Scale = Vector3.new(1.25, 1.25, 1.25)
Sound22.Name = "Empty"
Sound22.Parent = Part20
Sound22.SoundId = "rbxassetid://240785604"
Sound22.Volume = 1
Sound23.Name = "FireSound"
Sound23.Parent = Part20
Sound23.SoundId = "rbxassetid://330704232"
Sound23.Volume = 1
Sound24.Name = "Reload"
Sound24.Parent = Part20
Sound24.SoundId = "rbxassetid://198915489"
Sound24.Volume = 1
Fire25.Parent = Part20
Fire25.Size = 2
Fire25.Color = Color3.new(0.145098, 0.145098, 0.164706)
Fire25.Enabled = false
Fire25.Heat = 0
Fire25.SecondaryColor = Color3.new(0, 0, 0)
Fire25.Color = Color3.new(0.145098, 0.145098, 0.164706)
SpotLight26.Name = "Light"
SpotLight26.Parent = Part20
SpotLight26.Color = Color3.new(1, 1, 0.498039)
SpotLight26.Enabled = false
SpotLight26.Brightness = 50
SpotLight26.Range = 18
SpotLight26.Angle = 120
SpotLight26.Face = Enum.NormalId.Top
SpotLight26.Color = Color3.new(1, 1, 0.498039)
Animation27.Name = "FireAni"
Animation27.Parent = Tool4
Animation27.AnimationId = "http://www.roblox.com/Asset?ID=95383980"
Animation28.Name = "idle"
Animation28.Parent = Tool4
Animation28.AnimationId = "http://www.roblox.com/Asset?ID=95383474"
Tool29.Name = "Baton"
Tool29.Parent = mas
LocalScript30.Name = "Local Gui"
LocalScript30.Parent = Tool29
table.insert(cors,sandbox(LocalScript30,function()
local Tool = script.Parent;
enabled = true
function onButton1Down(mouse)
if not enabled then
return
end
enabled = true
end
function onEquippedLocal(mouse)
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = "http://www.roblox.com/asset/?id=2966012"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
Tool.Equipped:connect(onEquippedLocal)
end))
Script31.Name = "Weld"
Script31.Parent = Tool29
table.insert(cors,sandbox(Script31,function()
local prev
local parts = script.Parent:GetChildren()
for i = 1,#parts do
--remove any of the following parts that say "(parts[i].className == [className])" if you want to exclude that particular className type from the Weld
if ((parts[i].className == "Part") or (parts[i].className == "SpawnLocation") or (parts[i].className == "Seat") or (parts[i].className == "TrussPart") or (parts[i].className == "VehicleSeat")) then
if (prev ~= nil) then
local weld = Instance.new("Weld")
weld.Part0 = prev
weld.Part1 = parts[i]
weld.C0 = prev.CFrame:inverse()
weld.C1 = parts[i].CFrame:inverse()
weld.Parent = prev
parts[i].Anchored = false
end
prev = parts[i]
end
end
wait(3)
end))
Part32.Name = "Handle"
Part32.Parent = Tool29
Part32.Material = Enum.Material.Fabric
Part32.BrickColor = BrickColor.new("Black")
Part32.Rotation = Vector3.new(180, 0, -165)
Part32.FormFactor = Enum.FormFactor.Custom
Part32.Size = Vector3.new(0.300000012, 1, 0.300000012)
Part32.CFrame = CFrame.new(13.0473738, 2.52178431, 3.16040182, -0.965922058, 0.258817792, -3.82533472e-09, 0.258817792, 0.965922058, -2.83325789e-08, -3.77935461e-09, -2.80197128e-08, -1)
Part32.BottomSurface = Enum.SurfaceType.Weld
Part32.TopSurface = Enum.SurfaceType.Smooth
Part32.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part32.Position = Vector3.new(13.0473738, 2.52178431, 3.16040182)
Part32.Orientation = Vector3.new(0, -180, 15)
Part32.Color = Color3.new(0.105882, 0.164706, 0.207843)
CylinderMesh33.Parent = Part32
CylinderMesh33.Scale = Vector3.new(0.899999976, 1, 0.899999976)
CylinderMesh33.Scale = Vector3.new(0.899999976, 1, 0.899999976)
Weld34.Parent = Part32
Weld34.C0 = CFrame.new(-457.99826, -25.7006931, 446.902222, -1, 3.05171125e-05, 3.05180438e-05, 3.05180438e-05, 1, 3.05171125e-05, -3.05171125e-05, 3.05180438e-05, -1)
Weld34.C1 = CFrame.new(-457.987274, 27.7081051, -446.912628, -1, -3.05171125e-05, 3.05180438e-05, 3.05180438e-05, -1, 3.05171125e-05, 3.05171125e-05, 3.05180438e-05, 1)
Weld34.Part0 = Part32
Weld34.Part1 = Part40
Sound35.Name = "HitSound"
Sound35.Parent = Part32
Sound35.SoundId = "rbxassetid://169259022"
Sound35.Volume = 1
Sound36.Name = "LungeSound"
Sound36.Parent = Part32
Sound36.SoundId = "http://www.roblox.com/Asset/?ID= 101164100"
Sound36.Volume = 1
Sound37.Name = "OverheadSound"
Sound37.Parent = Part32
Sound37.SoundId = "http://www.roblox.com/Asset/?ID= 101164100"
Sound37.Volume = 1
Sound38.Name = "UnsheathSound"
Sound38.Parent = Part32
Sound38.SoundId = "rbxassetid://240784215"
Sound38.Volume = 1
Sound39.Name = "SlashSound"
Sound39.Parent = Part32
Sound39.SoundId = "http://www.roblox.com/Asset/?ID= 101164100"
Sound39.Volume = 1
Part40.Parent = Tool29
Part40.BrickColor = BrickColor.new("Really black")
Part40.Reflectance = 0.20000000298023
Part40.Rotation = Vector3.new(0, 0, 165)
Part40.FormFactor = Enum.FormFactor.Custom
Part40.Size = Vector3.new(0.300000012, 1, 0.300000012)
Part40.CFrame = CFrame.new(13.5757141, 4.45773554, 3.16909885, -0.965937853, -0.258758843, 1.57992508e-05, 0.258758843, -0.965937853, 5.89849187e-05, -1.91499905e-09, 6.10641073e-05, 1)
Part40.BottomSurface = Enum.SurfaceType.Weld
Part40.TopSurface = Enum.SurfaceType.Weld
Part40.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
Part40.Position = Vector3.new(13.5757141, 4.45773554, 3.16909885)
Part40.Orientation = Vector3.new(0, 0, 165)
Part40.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
CylinderMesh41.Parent = Part40
CylinderMesh41.Scale = Vector3.new(0.300000012, 1, 0.300000012)
CylinderMesh41.Scale = Vector3.new(0.300000012, 1, 0.300000012)
Weld42.Parent = Part40
Weld42.C0 = CFrame.new(-457.987274, 27.7081051, -446.912628, -1, -3.05171125e-05, 3.05180438e-05, 3.05180438e-05, -1, 3.05171125e-05, 3.05171125e-05, 3.05180438e-05, 1)
Weld42.C1 = CFrame.new(-457.993866, 26.698473, -446.906464, -1, -3.05171125e-05, 3.05180438e-05, 3.05180438e-05, -1, 3.05171125e-05, 3.05171125e-05, 3.05180438e-05, 1)
Weld42.Part0 = Part40
Weld42.Part1 = Part44
Script43.Parent = Part40
table.insert(cors,sandbox(Script43,function()
function onTouched(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.Sit = true
h.Health = h.Health - 0
end
end
script.Parent.Touched:connect(onTouched)
end))
Part44.Parent = Tool29
Part44.BrickColor = BrickColor.new("Really black")
Part44.Reflectance = 0.20000000298023
Part44.Rotation = Vector3.new(0, 0, 165)
Part44.FormFactor = Enum.FormFactor.Custom
Part44.Size = Vector3.new(0.300000012, 1, 0.300000012)
Part44.CFrame = CFrame.new(13.3080959, 3.48419905, 3.16299605, -0.965937853, -0.258758843, 1.57992508e-05, 0.258758843, -0.965937853, 5.89849187e-05, -1.91499905e-09, 6.10641073e-05, 1)
Part44.BottomSurface = Enum.SurfaceType.Weld
Part44.TopSurface = Enum.SurfaceType.Weld
Part44.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
Part44.Position = Vector3.new(13.3080959, 3.48419905, 3.16299605)
Part44.Orientation = Vector3.new(0, 0, 165)
Part44.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
CylinderMesh45.Parent = Part44
CylinderMesh45.Scale = Vector3.new(0.5, 1, 0.5)
CylinderMesh45.Scale = Vector3.new(0.5, 1, 0.5)
Weld46.Parent = Part44
Weld46.C0 = CFrame.new(-457.993866, 26.698473, -446.906464, -1, -3.05171125e-05, 3.05180438e-05, 3.05180438e-05, -1, 3.05171125e-05, 3.05171125e-05, 3.05180438e-05, 1)
Weld46.C1 = CFrame.new(-457.993408, 28.2644634, -446.909058, -1, -3.05161811e-05, 3.05189751e-05, 3.05189751e-05, -1, 9.15522687e-05, 3.05161811e-05, 9.15532e-05, 1)
Weld46.Part0 = Part44
Weld46.Part1 = Part48
Script47.Parent = Part44
table.insert(cors,sandbox(Script47,function()
function onTouched(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.Sit = true
h.Health = h.Health - 0
end
end
script.Parent.Touched:connect(onTouched)
end))
Part48.Parent = Tool29
Part48.BrickColor = BrickColor.new("Really black")
Part48.Reflectance = 0.20000000298023
Part48.Rotation = Vector3.new(-0.00999999978, 0, 165)
Part48.FormFactor = Enum.FormFactor.Custom
Part48.Size = Vector3.new(0.300000012, 0.200000003, 0.300000012)
Part48.CFrame = CFrame.new(13.7208099, 5.02307796, 3.16375327, -0.965937853, -0.258758843, 3.15935395e-05, 0.258758843, -0.965937853, 0.000117940843, -9.83733317e-10, 0.000122099271, 1)
Part48.BottomSurface = Enum.SurfaceType.Smooth
Part48.TopSurface = Enum.SurfaceType.Weld
Part48.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
Part48.Position = Vector3.new(13.7208099, 5.02307796, 3.16375327)
Part48.Orientation = Vector3.new(-0.00999999978, 0, 165)
Part48.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
CylinderMesh49.Parent = Part48
CylinderMesh49.Offset = Vector3.new(0, 0.150000006, 0)
CylinderMesh49.Scale = Vector3.new(0.5, 0.5, 0.5)
CylinderMesh49.Scale = Vector3.new(0.5, 0.5, 0.5)
Script50.Parent = Part48
table.insert(cors,sandbox(Script50,function()
function onTouched(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.Sit = true
h.Health = h.Health - 0
end
end
script.Parent.Touched:connect(onTouched)
end))
BoolValue51.Name = "PlayOverhead"
BoolValue51.Parent = Tool29
BoolValue52.Name = "PlaySlash"
BoolValue52.Parent = Tool29
BoolValue53.Name = "PlayThrust"
BoolValue53.Parent = Tool29
Script54.Name = "SwordScript"
Script54.Parent = Tool29
table.insert(cors,sandbox(Script54,function()
r = game:service("RunService")
local damage = 0
sword = script.Parent.Handle
Tool = script.Parent
local damages,values,sounds = {15,17,20},{Tool.PlaySlash,Tool.PlayThrust,Tool.PlayOverhead},{Tool.Handle.SlashSound,Tool.Handle.OverheadSound,Tool.Handle.LungeSound}
local enabledToDamage = true
function blow(hit)
if enabledToDamage == false then return end
enabledToDamage = false
if (hit.Parent == nil) then enabledToDamage = true return end -- happens when bullet hits sword
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
delay(1, function()
untagHumanoid(humanoid)
end)
else
enabledToDamage = true
end
else
enabledToDamage = true
end
else
enabledToDamage = true
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
script.Parent.Handle.SlashSound:Play()
script.Parent.PlaySlash.Value = not script.Parent.PlaySlash.Value
end
function lunge()
damage = lunge_damage
script.Parent.Handle.LungeSound:Play()
script.Parent.PlayOverhead.Value = not script.Parent.PlayOverhead.Value
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.5)
force.Parent = nil
wait(.5)
damage = slash_damage
end
Tool.Enabled = true
local last_attack = 0
local status = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
--if (t - last_attack < 1.5) then
if status == 3 then
status = 0
damage = 0
else
status = status + 1
values[status].Value = not values[status].Value
damage = damages[status]
sounds[status]:Play()
enabledToDamage = true
wait(0.5)
enabledToDamage = false
end
--else
--status = 0
--damage = 0
--end
last_attack = t
Tool.Enabled = true
end
function onEquipped()
wait(1/3)
Tool.Handle.UnsheathSound:Play()
end
Tool.Equipped:connect(onEquipped)
script.Parent.Activated:connect(onActivated)
connection = sword.Touched:connect(blow)
end))
LocalScript55.Name = "AnimationScript"
LocalScript55.Parent = Tool29
table.insert(cors,sandbox(LocalScript55,function()
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local Tool = script.Parent
local Animations = {}
local MyHumanoid
local MyCharacter
local function PlayAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Play()
end
end
local function StopAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Stop()
end
end
function OnEquipped(mouse)
MyCharacter = Tool.Parent
MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
if MyHumanoid then
Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2'))
Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2'))
Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2'))
Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2'))
end
PlayAnimation('EquipAnim')
PlayAnimation('IdleAnim')
end
function OnUnequipped()
for animName, _ in pairs(Animations) do
StopAnimation(animName)
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
WaitForChild(Tool, 'PlaySlash').Changed:connect(
function (value)
--if value then
PlayAnimation('SlashAnim')
--else
-- StopAnimation('SlashAnim')
--end
end)
WaitForChild(Tool, 'PlayThrust').Changed:connect(
function (value)
--if value then
PlayAnimation('ThrustAnim')
--else
-- StopAnimation('ThrustAnim')
--end
end)
WaitForChild(Tool, 'PlayOverhead').Changed:connect(
function (value)
--if value then
PlayAnimation('OverheadAnim')
--else
-- StopAnimation('OverheadAnim')
--end
end)
end))
Animation56.Name = "IdleAnim3"
Animation56.Parent = Tool29
Animation56.AnimationId = "http://www.roblox.com/Asset?ID=94108418"
Animation57.Name = "OverheadAnim2"
Animation57.Parent = Tool29
Animation57.AnimationId = "rbxassetid://186934753"
Animation58.Name = "UnequipAnim2"
Animation58.Parent = Tool29
Animation58.AnimationId = "http://www.roblox.com/Asset?ID=94095929"
Animation59.Name = "EquipAnim5"
Animation59.Parent = Tool29
Animation59.AnimationId = "http://www.roblox.com/Asset?ID=94160581"
Animation60.Name = "ThrustAnim2"
Animation60.Parent = Tool29
Animation60.AnimationId = "rbxassetid://186934753"
Animation61.Name = "SlashAnim2"
Animation61.Parent = Tool29
Animation61.AnimationId = "rbxassetid://186934753"
Tool62.Name = "RPG-7"
Tool62.Parent = mas
Tool62.GripPos = Vector3.new(0.0500000007, -0.600000024, -1)
Tool62.ToolTip = "RPG-7"
Tool62.CanBeDropped = false
Part63.Name = "Handle"
Part63.Parent = Tool62
Part63.Transparency = 1
Part63.Rotation = Vector3.new(92.1199951, 62, -91.8699951)
Part63.FormFactor = Enum.FormFactor.Custom
Part63.Size = Vector3.new(0.839999974, 1.14999998, 3.55000019)
Part63.CFrame = CFrame.new(-70.7470474, 13.1006594, 24.1488132, -0.0153169353, 0.469224393, 0.882945836, 0.00813866127, 0.883078873, -0.469153851, -0.999849558, 0, -0.0173449218)
Part63.BottomSurface = Enum.SurfaceType.Smooth
Part63.TopSurface = Enum.SurfaceType.Smooth
Part63.Position = Vector3.new(-70.7470474, 13.1006594, 24.1488132)
Part63.Orientation = Vector3.new(27.9799995, 91.1299973, 0.529999971)
SpecialMesh64.Parent = Part63
SpecialMesh64.MeshId = "http://www.roblox.com/asset/?id=94690054"
SpecialMesh64.TextureId = "http://www.roblox.com/asset/?id=94689966"
SpecialMesh64.MeshType = Enum.MeshType.FileMesh
Sound65.Name = "ReloadSound"
Sound65.Parent = Part63
Sound65.Pitch = 1.1000000238419
Sound65.SoundId = "http://www.roblox.com/Asset?ID=132456167"
Sound65.Volume = 1
Sound66.Name = "FireSound"
Sound66.Parent = Part63
Sound66.SoundId = "http://www.roblox.com/Asset?ID=132456187"
Sound66.Volume = 1
LocalScript67.Name = "MouseIcon"
LocalScript67.Parent = Tool62
table.insert(cors,sandbox(LocalScript67,function()
local MOUSE_ICON = 'rbxasset://textures/GunCursor.png'
local RELOADING_ICON = 'rbxasset://textures/GunWaitCursor.png'
local Tool = script.Parent
local Mouse = nil
local function UpdateIcon()
Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
end
local function OnEquipped(mouse)
Mouse = mouse
UpdateIcon()
end
local function OnChanged(property)
if property == 'Enabled' then
UpdateIcon()
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Changed:connect(OnChanged)
end))
Script68.Name = "Launcher"
Script68.Parent = Tool62
table.insert(cors,sandbox(Script68,function()
-----------------
--| Constants |--
-----------------
local COOLDOWN = 4 -- Seconds until tool can be used again
-- RocketPropulsion Fields
local TARGET_RADIUS = 5
local MAX_SPEED = 95
local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
local MAX_THRUST = 50000
local THRUST_P = 500
local THRUST_D = 50000
local TARGET_OVERSHOOT_DISTANCE = 10000000
local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
local ROCKET_MESH_SCALE = Vector3.new(2.5, 2.5, 2)
local ROCKET_PART_SIZE = Vector3.new(1, 1, 4)
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local Tool = script.Parent
local ToolHandle = Tool.Handle
local RocketScript = WaitForChild(script, 'Rocket')
local SwooshSound = WaitForChild(script, 'Swoosh')
local BoomSound = WaitForChild(script, 'Boom')
local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
local FireSound = WaitForChild(ToolHandle, 'FireSound')
local MyModel = nil
local MyPlayer = nil
local BaseRocket = nil
local RocketClone = nil
-----------------
--| Functions |--
-----------------
local function MakeBaseRocket()
-- Set up the rocket part
local rocket = Instance.new('Part')
rocket.Name = 'Rocket'
rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
rocket.Size = ROCKET_PART_SIZE
rocket.CanCollide = false
rocket.BottomSurface = Enum.SurfaceType.Smooth
rocket.TopSurface = Enum.SurfaceType.Smooth
-- Add the mesh
local mesh = Instance.new('SpecialMesh', rocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
-- Add fire
local fire = Instance.new('Fire', rocket)
fire.Heat = 3
fire.Size = 2
-- Add the propulsion
local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
rocketPropulsion.CartoonFactor = 1
rocketPropulsion.TargetRadius = TARGET_RADIUS
rocketPropulsion.MaxSpeed = MAX_SPEED
rocketPropulsion.MaxTorque = MAX_TORQUE
rocketPropulsion.MaxThrust = MAX_THRUST
rocketPropulsion.ThrustP = THRUST_P
rocketPropulsion.ThrustD = THRUST_D
-- Clone the sounds
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.Parent = rocket
-- Attach creator tags
local creatorTag = Instance.new('ObjectValue', rocket)
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = rocket
rocketScriptClone.Disabled = false
return rocket
end
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
end
local function OnActivated(byFireButton)
if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Get the target position
local targetPosition = MyModel.Humanoid.TargetPoint
if byFireButton then -- Using Fire Button, shoot forwards
targetPosition = MyModel.Humanoid.Torso.CFrame.lookVector * 1000
end
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.z / 2))
RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
DebrisService:AddItem(RocketClone, 30)
RocketClone.Parent = Workspace
-- Assign target and launch!
FireSound:Play()
local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
if rocketPropulsion then
local direction = (targetPosition - RocketClone.Position).unit
rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
rocketPropulsion:Fire()
end
RocketClone.Touched:connect(function(hit)
--print("oof")
-----------------
--| Constants |--
-----------------
local BLAST_RADIUS = 6
local BLAST_PRESSURE = 750000
-- Rocket will fly through things named these
local ROCKET_IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} --NOTE: Keys must be lowercase, values must evaluate to true
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local DebrisService = Game:GetService('Debris')
local Rocket = RocketClone
local CreatorTag = WaitForChild(Rocket, 'creator')
local Connection = nil
-----------------
--| Functions |--
-----------------
-- Returns the ancestor that contains a Humanoid, if it exists
local function FindCharacterAncestor(subject)
if subject and subject ~= Workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return FindCharacterAncestor(subject.Parent)
end
end
return nil
end
local function OnExplosionHit(hitPart)
if hitPart then
local _, humanoid = FindCharacterAncestor(hitPart.Parent)
if humanoid then
humanoid.Parent:BreakJoints()
local hitBindable = humanoid:FindFirstChild('Hit')
if hitBindable then
hitBindable:Invoke(0, CreatorTag)
else
print("Could not find BindableFunction 'Hit'")
end
end
end
end
local function OnTouched(otherPart)
if Rocket and otherPart and not Rocket:FindFirstChild("IsDone") then
-- Fly through anything in the ignore list
if ROCKET_IGNORE_LIST[string.lower(otherPart.Name)] then
return
end
-- Fly through the creator
local myPlayer = CreatorTag.Value
if myPlayer and myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
return
end
-- Create the explosion
local explosion = Instance.new('Explosion')
explosion.BlastPressure = BLAST_PRESSURE
explosion.BlastRadius = BLAST_RADIUS
explosion.Position = Rocket.Position
explosion.Hit:connect(OnExplosionHit)
explosion.Parent = Workspace
tag = Instance.new("BoolValue", Rocket)
tag.Name = "IsDone"
-- Start playing the boom sound
local boomSound = Rocket:FindFirstChild('Boom')
if boomSound then
boomSound:Play()
end
-- NOTE:
-- If we just destroyed the rocket at this point, the boom sound would be destroyed too,
-- so instead we will hide the rocket, keep it in the same spot, and schedule it for deletion
-- Stop playing the swoosh sound
local swooshSound = Rocket:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Stop()
end
-- Put out the fire
local fire = Rocket:FindFirstChild('Fire')
if fire then
fire:Destroy()
end
Rocket.Transparency = 1
Rocket.CanCollide = false
Rocket.Anchored = true
DebrisService:AddItem(Rocket, 3)
-- Destroy the connection so this method won't be called again
Connection:disconnect()
end
end
--------------------
--| Script Logic |--
--------------------
-- Arm the rocket and save the touch connection so we can disconnect it later
Connection = Rocket.Touched:connect(OnTouched)
end)
wait(0) --TODO: Remove when sounds realize they can be played as soon as they enter the Workspace
-- Swoosh!
local swooshSound = RocketClone:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Play()
end
-- Prepare the next rocket to be fired
RocketClone = BaseRocket:Clone()
ReloadSound:Play()
wait(COOLDOWN)
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop() --TODO: This does not work online
end
-- Also activate when the Fire Button is down
local function OnChildAdded(child)
if child.Name == 'FireButtonDown' then
child.Changed:connect(function(newValue)
if newValue == true then
OnActivated(true)
end
end)
end
end
--------------------
--| Script Logic |--
--------------------
Tool.Equipped:connect(OnEquipped)
Tool.Activated:connect(OnActivated)
Tool.Unequipped:connect(OnUnequipped)
Tool.ChildAdded:connect(OnChildAdded) --NOTE: Added for Fire Button
end))
Sound69.Name = "Boom"
Sound69.Parent = Script68
Sound69.SoundId = "http://www.roblox.com/Asset?ID=133680244"
Sound69.Volume = 1
Sound70.Name = "Swoosh"
Sound70.Parent = Script68
Sound70.Pitch = 1.2999999523163
Sound70.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
Sound70.Volume = 0.69999998807907
Sound70.Looped = true
Script71.Name = "Rocket"
Script71.Parent = Script68
Script71.Disabled = true
table.insert(cors,sandbox(Script71,function()
-----------------
--| Constants |--
-----------------
local BLAST_RADIUS = 6
local BLAST_PRESSURE = 750000
-- Rocket will fly through things named these
local ROCKET_IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} --NOTE: Keys must be lowercase, values must evaluate to true
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local DebrisService = Game:GetService('Debris')
local Rocket = script.Parent
local CreatorTag = WaitForChild(Rocket, 'creator')
local Connection = nil
-----------------
--| Functions |--
-----------------
-- Returns the ancestor that contains a Humanoid, if it exists
local function FindCharacterAncestor(subject)
if subject and subject ~= Workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return FindCharacterAncestor(subject.Parent)
end
end
return nil
end
local function OnExplosionHit(hitPart)
if hitPart then
local _, humanoid = FindCharacterAncestor(hitPart.Parent)
if humanoid then
humanoid.Parent:BreakJoints()
local hitBindable = humanoid:FindFirstChild('Hit')
if hitBindable then
hitBindable:Invoke(0, CreatorTag)
else
print("Could not find BindableFunction 'Hit'")
end
end
end
end
local function OnTouched(otherPart)
if Rocket and otherPart then
-- Fly through anything in the ignore list
if ROCKET_IGNORE_LIST[string.lower(otherPart.Name)] then
return
end
-- Fly through the creator
local myPlayer = CreatorTag.Value
if myPlayer and myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
return
end
-- Create the explosion
local explosion = Instance.new('Explosion')
explosion.BlastPressure = BLAST_PRESSURE
explosion.BlastRadius = BLAST_RADIUS
explosion.Position = Rocket.Position
explosion.Hit:connect(OnExplosionHit)
explosion.Parent = Workspace
-- Start playing the boom sound
local boomSound = Rocket:FindFirstChild('Boom')
if boomSound then
boomSound:Play()
end
-- NOTE:
-- If we just destroyed the rocket at this point, the boom sound would be destroyed too,
-- so instead we will hide the rocket, keep it in the same spot, and schedule it for deletion
-- Stop playing the swoosh sound
local swooshSound = Rocket:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Stop()
end
-- Put out the fire
local fire = Rocket:FindFirstChild('Fire')
if fire then
fire:Destroy()
end
Rocket.Transparency = 1
Rocket.CanCollide = false
Rocket.Anchored = true
DebrisService:AddItem(Rocket, 3)
-- Destroy the connection so this method won't be called again
Connection:disconnect()
end
end
--------------------
--| Script Logic |--
--------------------
-- Arm the rocket and save the touch connection so we can disconnect it later
Connection = Rocket.Touched:connect(OnTouched)
end))
LocalScript72.Name = "Animation"
LocalScript72.Parent = Tool62
table.insert(cors,sandbox(LocalScript72,function()
--------------------
--| WaitForChild |--
--------------------
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local Tool = script.Parent
local FireAndReloadAnimation = WaitForChild(script, 'FireAndReload')
local FireAndReloadTrack = nil
-----------------
--| Functions |--
-----------------
local function OnEquipped()
local myModel = Tool.Parent
local humanoid = myModel:FindFirstChild('Humanoid')
if humanoid then -- Preload animations
FireAndReloadTrack = humanoid:LoadAnimation(FireAndReloadAnimation)
end
end
local function OnChanged(property)
if property == 'Enabled' and Tool.Enabled == false then
-- Play fire and reload animation
if FireAndReloadTrack then
FireAndReloadTrack:Play()
end
end
end
local function OnUnequipped()
-- Stop animations
if FireAndReloadTrack then FireAndReloadTrack:Stop() end
end
--------------------
--| Script Logic |--
--------------------
Tool.Equipped:connect(OnEquipped)
Tool.Changed:connect(OnChanged)
Tool.Unequipped:connect(OnUnequipped)
end))
Animation73.Name = "FireAndReload"
Animation73.Parent = LocalScript72
Animation73.AnimationId = "http://www.roblox.com/Asset?ID=94771598"
LocalScript74.Name = "VisualizeReload"
LocalScript74.Parent = Tool62
table.insert(cors,sandbox(LocalScript74,function()
-----------------
--| Constants |--
-----------------
local ROCKET_MESH_ID = ''
local ROCKET_MESH_SCALE = Vector3.new(1, 1, 1)
local ANIM_TOTAL_TIME = 3.4 -- Total length of FireAndReload animation
local ROCKET_SHOW_TIME = 1.5 -- Seconds after animation begins to show the rocket
local ROCKET_HIDE_TIME = 2.2 -- Seconds after animation begins to hide the rocket
-----------------
--| Variables |--
-----------------
local Tool = script.Parent
local ToolHandle = Tool.Handle
local MyModel = nil
local ReloadRocket = nil
local StillEquipped = false
-----------------
--| Functions |--
-----------------
local function MakeReloadRocket()
local reloadRocket = Instance.new('Part')
reloadRocket.Name = "Ammo"
reloadRocket.Transparency = 1
reloadRocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
reloadRocket.Size = Vector3.new() -- As small as possible
local mesh = Instance.new('SpecialMesh', reloadRocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
return reloadRocket
end
local function OnEquipped()
MyModel = Tool.Parent
ReloadRocket = MakeReloadRocket()
end
local function OnChanged(property)
if property == 'Enabled' and Tool.Enabled == false then
-- Show the next rocket going into the launcher
StillEquipped = true
wait(ROCKET_SHOW_TIME)
if StillEquipped then
local leftArm = MyModel:FindFirstChild('Left Arm')
if leftArm then
local weld = ReloadRocket:FindFirstChild('Weld')
if not weld then
weld = Instance.new('Weld')
weld.Part0 = leftArm
weld.Part1 = ReloadRocket
weld.C1 = CFrame.new(Vector3.new(0, 1, 0))
weld.Parent = ReloadRocket
end
ReloadRocket.Parent = MyModel
end
wait(ROCKET_HIDE_TIME - ROCKET_SHOW_TIME)
if StillEquipped and ReloadRocket.Parent == MyModel then
ReloadRocket.Parent = nil
end
end
end
end
local function OnUnequipped()
StillEquipped = false
ReloadRocket:Destroy()
ReloadRocket = nil
end
--------------------
--| Script Logic |--
--------------------
Tool.Equipped:connect(OnEquipped)
Tool.Changed:connect(OnChanged)
Tool.Unequipped:connect(OnUnequipped)
end))
Part75.Name = "RPG-7"
Part75.Parent = Tool62
Part75.Rotation = Vector3.new(92.1199951, 62, -91.8699951)
Part75.CanCollide = false
Part75.FormFactor = Enum.FormFactor.Symmetric
Part75.Size = Vector3.new(1, 1, 4)
Part75.CFrame = CFrame.new(-71.2503738, 13.141613, 24.1718769, -0.0153171355, 0.469224393, 0.882945538, 0.00813870504, 0.883078873, -0.469153672, -0.99984926, -5.7471425e-08, -0.0173451193)
Part75.BottomSurface = Enum.SurfaceType.Smooth
Part75.TopSurface = Enum.SurfaceType.Smooth
Part75.Position = Vector3.new(-71.2503738, 13.141613, 24.1718769)
Part75.Orientation = Vector3.new(27.9799995, 91.1299973, 0.529999971)
SpecialMesh76.Parent = Part75
SpecialMesh76.MeshId = "http://www.roblox.com/asset/?id=88742477"
SpecialMesh76.Scale = Vector3.new(2.5, 2.5, 2.5)
SpecialMesh76.TextureId = "http://www.roblox.com/asset/?id=88745396"
SpecialMesh76.MeshType = Enum.MeshType.FileMesh
SpecialMesh76.Scale = Vector3.new(2.5, 2.5, 2.5)
Script77.Name = "UltimateWeld"
Script77.Parent = Tool62
table.insert(cors,sandbox(Script77,function()
--DO NOT USE BOTH WELDING SCRIPTS PROVIDED BY THIS MODEL
--The regular script is recommended
--[[
Prevents welds from breaking/transforming when player uses the tool
This recreates the EXACT weld every time
This also prevents lag build up by clearing old welds, the tradition weld script just keeps making new
ones, which can lead to weapons have crazy amounts of welds that dont work (I saw 6000 in a weapon once)
]]
--[[Usage
1. Remove Old welding script (optional, only if updating a weapon and that weapon does not rely on that script)
2. Anchor all parts of tool and put inside of a tool object
3. Place this script in that tool (make sure you do this AFTER step 2, otherwise it may fail)
4. Treat like normal tool, nothing special has to be done with it
]]
--[[The local script included in this model can only be used if
1. The weapon is being placed in the players backpack first (i.e. the weapon is in starterpack and moves to player backpack)
OR
2. The weapon is previously welded (weapon can be placed in workspace and picked up then)
]]
repeat wait() until script.Parent:FindFirstChild("Handle")
local welds={}
function ClearOldWelds(tbl)
for _,v in pairs(tbl) do
if v:IsA('Weld') then
v:Destroy()
end
end
end
function Equipped()
local handle=script.Parent:FindFirstChild('Handle')
if not handle then return end
local tble=handle:GetChildren()
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA('BasePart') and v~=handle then
local c1
for _1,v1 in pairs(welds) do
if _1==v then
c1=v1
break
end
end
if not c1 then
welds[v]=v.CFrame:inverse()*handle.CFrame
v.Anchored=false
c1=welds[v]
end
local weld=Instance.new('Weld')
weld.Part0=handle
weld.Part1=v
weld.C0=CFrame.new()
weld.C1=c1
weld.Parent=handle
end
end
ClearOldWelds(tble)
handle.Anchored=false
end
Equipped()
script.Parent.Equipped:connect(Equipped)
--Made by DonnyTheDemented
end))
Script78.Name = "Welding"
Script78.Parent = Tool62
table.insert(cors,sandbox(Script78,function()
function Weld(x,y)
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
end
function Get(A)
if A.className == "Part" then
Weld(script.Parent.Handle, A)
A.Anchored = false
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end
function Finale()
Get(script.Parent)
end
script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()
end))
LocalScript79.Name = "BackupWeld"
LocalScript79.Parent = Tool62
table.insert(cors,sandbox(LocalScript79,function()
function Weld(x,y)
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
end
function Get(A)
if A.className == "Part" then
Weld(script.Parent.Handle, A)
A.Anchored = false
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end
function Finale()
Get(script.Parent)
end
script.Parent.Equipped:connect(Finale)
script.Parent.Unequipped:connect(Finale)
Finale()
end))
LocalScript80.Name = "CameraMoveDev"
LocalScript80.Parent = Tool62
table.insert(cors,sandbox(LocalScript80,function()
local RunService = game:GetService('RunService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
repeat wait() until player.Character
repeat wait() until player.Character:FindFirstChild("Humanoid")
repeat wait() until player.Character:FindFirstChild("Torso")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
torso = character.Torso
keyhold = false
--player.CameraMinZoomDistance = 0.5
lighting = true
haslight = false
mouse.TargetFilter = nil
--humanoid.JumpPower = 0
maxcount = 100
runcount = maxcount
function populateparts(mdl)
if mdl:IsA("BasePart") then
table.insert(parts,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populateparts(mdl2)
end
end
function weldBetween(a, b)
--Make a new Weld and Parent it to a.
weld = Instance.new("ManualWeld", a)
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Set the Part0 and Part1 properties respectively
weld.Part0 = a
weld.Part1 = b
--Return the reference to the weld so that you can change it later.
return weld
end
humanoid.Died:connect(function()
if armgroup then
armgroup:Destroy()
if cl then
cl:Destroy()
end
if cl2 then
cl2:Destroy()
end
end
end)
LocalObjects = {}
function SetLocalTransparency(Table)
for i, v in pairs(LocalObjects) do
if v.Object == Table.Object then
Table.Object.LocalTransparencyModifier = Table.OriginalTransparency
table.remove(LocalObjects, i)
end
end
if not Table.Transparency then
return
end
Table.OriginalTransparency = Table.Object.LocalTransparencyModifier
table.insert(LocalObjects, Table)
if ModifyTransparency then
ModifyTransparency:disconnect()
end
ModifyTransparency = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
local function SetupJoints()
if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
return -- TODO: Make tracking compatible with R15
end
torso = character:FindFirstChild("Torso")
Neck = torso.Neck
OldNeckC0 = Neck.C0
OldNeckC1 = Neck.C1
Shoulder = torso['Right Shoulder']
Shoulder2 = torso['Left Shoulder']
OldShoulderC0 = Shoulder.C0
OldShoulderC1 = Shoulder.C1
OldShoulder2C0 = Shoulder2.C0
OldShoulder2C1 = Shoulder2.C1
end
local function visual()
if Tool then
if Tool:FindFirstChild("GetKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.5
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetKill:Destroy()
end
if Tool:FindFirstChild("GetHeadKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.75
Color.TintColor = Color3.new(1, 0.9, 0.9)
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetHeadKill:Destroy()
end
end
--player.CameraMode = Enum.CameraMode.LockFirstPerson
end
SetupJoints()
game:GetService("RunService").RenderStepped:connect(function()
if character and humanoid.Health > 0 and script.Parent.Parent == character then
if character:FindFirstChildOfClass("Tool") and character:FindFirstChildOfClass("Tool") == script.Parent then
Tool = character:FindFirstChildOfClass("Tool")
visual()
else
Tool = nil
end
if Tool then
character.Humanoid.AutoRotate = false
mouse.TargetFilter = game.Workspace
--if (game.Workspace.CurrentCamera.CoordinateFrame.p - game.Workspace.CurrentCamera.Focus.p).magnitude < 1 then
--game.Workspace.CurrentCamera.CameraSubject = character.Head
game.Workspace.CurrentCamera.Focus = character.Head.CFrame
--end
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
local toMouse = (mouse.Hit.p - character.Head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
character.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2,0)
character.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/-2,0)
if character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
character['Torso'].CFrame = CFrame.new(character['Torso'].Position, character['Torso'].Position + (Vector3.new(
mouse.Hit.x, character['Torso'].Position.Y, mouse.Hit.z)-character['Torso'].Position).unit)
end
else
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end
end
end)
script.Parent.Unequipped:connect(function()
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end)
end))
Tool81.Name = "Shield"
Tool81.Parent = mas
Tool81.GripPos = Vector3.new(-0.300000012, 0, -0.5)
Part82.Parent = Tool81
Part82.Material = Enum.Material.Metal
Part82.BrickColor = BrickColor.new("Black")
Part82.Rotation = Vector3.new(0, 0, -180)
Part82.FormFactor = Enum.FormFactor.Custom
Part82.Size = Vector3.new(0.5, 0.850000024, 0.200000003)
Part82.CFrame = CFrame.new(14.1200104, 4.75788403, 0.600117028, -1, 0, 0, 0, -1, 0, 0, 0, 1)
Part82.BottomSurface = Enum.SurfaceType.Smooth
Part82.TopSurface = Enum.SurfaceType.Smooth
Part82.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part82.Position = Vector3.new(14.1200104, 4.75788403, 0.600117028)
Part82.Orientation = Vector3.new(0, 0, 180)
Part82.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh83.Parent = Part82
BlockMesh83.Scale = Vector3.new(1, 1, 0.5)
BlockMesh83.Scale = Vector3.new(1, 1, 0.5)
Part84.Name = "GlassPart"
Part84.Parent = Tool81
Part84.Material = Enum.Material.Glass
Part84.BrickColor = BrickColor.new("Institutional white")
Part84.Transparency = 0.5
Part84.Rotation = Vector3.new(0, -28.3899994, 0)
Part84.FormFactor = Enum.FormFactor.Custom
Part84.Size = Vector3.new(0.5, 2.20000005, 0.200000003)
Part84.CFrame = CFrame.new(11.761734, 3.24806309, -0.0815239996, 0.879726708, 3.70690686e-05, -0.475472778, -2.21015525e-05, 1, 3.70690686e-05, 0.475472778, -2.21015525e-05, 0.879726708)
Part84.BottomSurface = Enum.SurfaceType.Smooth
Part84.TopSurface = Enum.SurfaceType.Smooth
Part84.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part84.Position = Vector3.new(11.761734, 3.24806309, -0.0815239996)
Part84.Orientation = Vector3.new(0, -28.3899994, 0)
Part84.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh85.Parent = Part84
BlockMesh85.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh85.Scale = Vector3.new(1, 1, 0)
BlockMesh85.Scale = Vector3.new(1, 1, 0)
Script86.Name = "Weld"
Script86.Parent = Tool81
table.insert(cors,sandbox(Script86,function()
local all,last = {}
function scan(p)
for _,v in pairs(p:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Part0,w.Part1 = last,v
w.C0 = v.CFrame:toObjectSpace(last.CFrame):inverse()
w.Parent = last
end
table.insert(all,v)
last = v
end
scan(v)
end
end
scan(script.Parent)
for _,v in pairs(all) do v.Anchored = false end
end))
LocalScript87.Name = "Local Gui"
LocalScript87.Parent = Tool81
table.insert(cors,sandbox(LocalScript87,function()
-------------------------------------
ToolName="Riot Shield"
ClipSize=1
ReloadTime=0.1
Firerate=.1
MinSpread=0
MaxSpread=0
SpreadRate=0.0001
BaseDamage=75
automatic=false
burst=false
shot=false
automacy = 0
run = 0
gaurd = 0
knife = 0
a = false
cam = nil
BarrlePos=Vector3.new(0,0,0)
Cursors={""}
ReloadCursor=""
-------------------------------------
equiped=false
sp=script.Parent
RayLength=2
enabled=true
reloading=false
down=false
r=game:service("RunService")
last=0
last2=0
last3=0
last4=0
last5=0
last6=0
Bullet=Instance.new("Part")
Bullet.Name="Bullet"
Bullet.BrickColor=BrickColor.new("New Yeller")
Bullet.Anchored=true
Bullet.CanCollide=false
Bullet.Locked=true
Bullet.Size=Vector3.new(1,1,1)
Bullet.Transparency=1
Bullet.formFactor=0
Bullet.TopSurface=0
Bullet.BottomSurface=0
mesh=Instance.new("SpecialMesh")
mesh.Parent=Bullet
mesh.MeshType="Brick"
mesh.Name="Mesh"
mesh.Scale=Vector3.new(.15,.15,1)
function check()
sp.Name=ToolName
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}
function Equip(mouse)
wait(0.01)
char = Tool.Parent
human = char:WaitForChild("Humanoid")
oldhealth = human.Health
healthloop = human.HealthChanged:connect(function(health)
if health < oldhealth then
human.Health = oldhealth
end
end)
standloop = game:GetService("RunService").RenderStepped:connect(function()
if human and human.Health > 0 then
human.WalkSpeed = 12
human.AutoRotate = true
human.PlatformStand = false
if char.Parent ~= workspace then
char.Parent = workspace
end
end
end)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[2].Part1 = nil
weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-90), 0) --(forwards/backwards,
welds[2] = weld2
end
else
print("sh")
end
else
print("arms")
end
end
function Unequip(mouse)
if standloop then
human.WalkSpeed = 16
standloop:disconnect()
end
if healthloop then
healthloop:disconnect()
end
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[2].Part1 = arms[2]
welds[2].Parent = nil
end
else
print("sh")
end
else
print("arms")
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
------------------------------------------------------------------------------------Raycasting functions
function cross(vector1, vector2)
return Vector3.new(vector1.y * vector2.z - vector2.y * vector1.z, vector1.z * vector2.x - vector1.x * vector2.z, vector1.x * vector2.y - vector2.x * vector1.y)
end
function dot(vector1, vector2)
return (vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z)
end
function getLineSphereCollide(linePoint1, lineVector, sphereCenter, radius)
local a = lineVector.x * lineVector.x + lineVector.y * lineVector.y + lineVector.z * lineVector.z
local b = lineVector.x * (linePoint1.x - sphereCenter.x) + lineVector.y * (linePoint1.y - sphereCenter.y) + lineVector.z * (linePoint1.z - sphereCenter.z)
local c = (linePoint1.x - sphereCenter.x) * (linePoint1.x - sphereCenter.x) + (linePoint1.y - sphereCenter.y) * (linePoint1.y - sphereCenter.y) + (linePoint1.z - sphereCenter.z) * (linePoint1.z - sphereCenter.z) - radius * radius
if (a > 0) and (b * b >= a * c) then
local diff = math.sqrt(b * b - a * c)
return ((-b - diff) / a), ((diff - b) / a)
else
return -1, -1
end
end
--Returns hit, position, normal, time
function raycast(model, start, vector, brickFunction)
local hit, normal, time = raycastRecursive(model, start, vector, brickFunction, vector.unit, dot(start, vector.unit))
if (dot(normal, vector) > 0) then
normal = -normal
end
return hit, start + time * vector, normal.unit, time
end
function raycastRecursive(model, start, vector, brickFunction, unitVec, startDist)
if (model.className == "Part") or (model.className == "Seat") or (model.className =="SpawnLocation") then
local range = model.Size.magnitude / 2
local dist = dot(model.Position, unitVec) - startDist
if (dist + range > 0) and (dist - range < vector.magnitude) and ((dist * unitVec + start - model.Position).magnitude < range) and brickFunction(model) then
local halfSize = model.Size / 2
if (model.Shape == Enum.PartType.Ball) then
local time, timeMax = getLineSphereCollide(start, vector, model.Position, halfSize.x)
if (time < 1) and (time >= 0) then
return model, (time * vector + start - model.Position), time
else
return nil, Vector3.new(0, 0, 0), 1
end
elseif (model.Shape == Enum.PartType.Block) then
local time = 1
local cf = model.CFrame - model.Position
local xvec = cf * Vector3.new(1, 0, 0)
local yvec = cf * Vector3.new(0, 1, 0)
local zvec = cf * Vector3.new(0, 0, 1)
local xspd = -dot(xvec, vector)
local yspd = -dot(yvec, vector)
local zspd = -dot(zvec, vector)
local xmin, xmax, ymin, ymax, zmin, zmax = -1
local dotProd = dot(xvec, start - model.Position)
if (xspd ~= 0) then
xmin = (dotProd - halfSize.x) / xspd
xmax = (dotProd + halfSize.x) / xspd
if (xmax < xmin) then
local swap = xmin
xmin = xmax
xmax = swap
end
else
if (math.abs(dotProd) < halfSize.x) then
xmax = 1
xmin = 0
else
return nil, Vector3.new(0, 0, 0), 1
end
end
local dotProd = dot(yvec, start - model.Position)
if (yspd ~= 0) then
ymin = (dotProd - halfSize.y) / yspd
ymax = (dotProd + halfSize.y) / yspd
if (ymax < ymin) then
local swap = ymin
ymin = ymax
ymax = swap
end
else
if (math.abs(dotProd) < halfSize.y) then
ymax = 1
ymin = 0
else
return nil, Vector3.new(0, 0, 0), 1
end
end
local dotProd = dot(zvec, start - model.Position)
if (zspd ~= 0) then
zmin = (dotProd - halfSize.z) / zspd
zmax = (dotProd + halfSize.z) / zspd
if (zmax < zmin) then
local swap = zmin
zmin = zmax
zmax = swap
end
else
if (math.abs(dotProd) < halfSize.z) then
zmax = 1
zmin = 0
else
return nil, Vector3.new(0, 0, 0), 1
end
end
if (xmin <= ymax) and (xmax >= ymin) and (xmin <= zmax) and (xmax >= zmin) and (zmin <= ymax) and (zmax >= ymin) then
local normal = xvec
local min = xmin
if (ymin > min) then
min = ymin
normal = yvec
end
if (zmin > min) then
min = zmin
normal = zvec
end
if (min >= 0) and (min < 1) then
time = min
elseif (xmax > 0) and (ymax > 0) and (zmax > 0) and (min < 0) then
time = 0
normal = Vector3.new(0, 0, 0)
end
return model, normal, time
else
return nil, Vector3.new(0, 0, 0), 1
end
else -- Cylinder
local time = 1
local cf = model.CFrame - model.Position
local xvec = cf * Vector3.new(1, 0, 0)
local xspd = -dot(xvec, vector)
local xmin, xmax = -1
local dotProd = dot(xvec, start - model.Position)
if (xspd ~= 0) then
xmin = (dotProd - halfSize.x) / xspd
xmax = (dotProd + halfSize.x) / xspd
if (xmax < xmin) then
local swap = xmin
xmin = xmax
xmax = swap
end
else
if (math.abs(dotProd) < halfSize.x) then
xmax = 1
xmin = 0
else
return nil, Vector3.new(0, 0, 0), 1
end
end
local relVec = cf:pointToObjectSpace(vector) * Vector3.new(0, 1, 1)
local relPos = model.CFrame:pointToObjectSpace(start) * Vector3.new(0, 1, 1)
local rmin, rmax = getLineSphereCollide(relPos, relVec, Vector3.new(0, 0, 0), halfSize.y)
if (xmin <= rmax) and (xmax >= rmin) and (rmax > 0) then
local normal = xvec
local min = xmin
if (rmin > min) then
min = rmin
normal = cf * (relPos + relVec * min)
end
if (min >= 0) and (min < 1) then
time = min
elseif (xmax > 0) and (rmax > 0) and (min < 0) then
time = 0
normal = Vector3.new(0, 0, 0)
end
return model, normal, time
else
return nil, Vector3.new(0, 0, 0), 1
end
return nil, Vector3.new(0, 0, 0), 1
end
end
return nil, Vector3.new(0, 0, 0), 1
elseif (model.className=="Model") or (model.className=="Workspace") or (model.className=="Hat") or (model.className == "Tool") then
local children=model:GetChildren()
local time=1
local normal=Vector3.new(0, 0, 0)
local hit=nil
for n = 1, #children do
if children[n]~= nil then
local newHit, newNormal, newTime = raycastRecursive(children[n], start, vector, brickFunction, unitVec, startDist)
if (newTime < time) then
time = newTime
hit = newHit
normal = newNormal
end
end
end
return hit, normal, time
else
return nil, Vector3.new(0, 0, 0), 1
end
end
-------------------------------------------------------------------------------
function tagHumanoid(humanoid)
local plr=game.Players:playerFromCharacter(sp.Parent)
if plr~=nil then
local tag=Instance.new("ObjectValue")
tag.Value=plr
tag.Name="creator"
tag.Parent=humanoid
delay(2,function()
if tag~=nil then
tag.Parent=nil
end
end)
end
end
function reload(mouse)
reloading=true
while sp.Ammo.Value<ClipSize and sp.TotalAmmo.Value>0 and reloading and enabled do
wait(ReloadTime/ClipSize)
if reloading then
check()
else
break
end
end
check()
mouse.Icon=Cursors[1]
reloading=false
end
function onKeyDown(key,mouse)
key=key:lower()
if key=="r" and not reloading and (sp.Ammo.Value < ClipSize) and run == 0 then
reload(mouse)
end
if (key=="f") then
if run == 0 and not reloading then
enabled = false
sp.Parent.Humanoid.WalkSpeed = 18
weld2.C1 = CFrame.new(-1, -0.4, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-70), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-50), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.1, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-30), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, 0, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-10), 0) --(forwards/backwards,
run = 1
elseif run == 1 then
enabled = true
sp.Parent.Humanoid.WalkSpeed = 16
weld2.C1 = CFrame.new(-1, -0.1, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-30), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.25, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-50), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.4, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-70), 0)
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-90), 0) --(forwards/backwards,
run = 0
end
end
end
function movecframe(p,pos)
p.Parent=game.Lighting
p.Position=pos
p.Parent=game.Workspace
end
function fire(aim)
weld2.C1 = CFrame.new(-1, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-80), -0.02) --(forwards/backwards,
wait(0.05)
weld2.C1 = CFrame.new(-1.3, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-75), -0.04) --(forwards/backwards,
wait(0.05)
weld2.C1 = CFrame.new(-1.6, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-70), -0.06) --(forwards/backwards,
wait(0.05)
sp.Handle.Fire:Play()
weld2.C1 = CFrame.new(-1.9, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-65), -0.08) --(forwards/backwards,
t=r.Stepped:wait()
last6=last5
last5=last4
last4=last3
last3=last2
last2=last
last=t
local bullet=Bullet:clone()
local bt2=game.Lighting.BulletTexture:clone()
bt2.BrickColor=BrickColor.new("Bright red")
bt2.Mesh.Scale=Vector3.new(.5,.5,2)
local totalDist=0
Lengthdist=-RayLength/.5
local startpoint=sp.Barrel.CFrame*BarrlePos
local dir=(aim)-startpoint
dir=computeDirection(dir)
local cfrm=CFrame.new(startpoint, dir+startpoint)
local hit,pos,normal,time=raycast(game.Workspace, startpoint, cfrm*Vector3.new(0,0,Lengthdist)-startpoint, function(brick)
if brick.Name=="Glass" then
return true
elseif brick.Name=="Bullet" or brick.Name=="BulletTexture" then
return false
elseif brick.ClassName=="Hat" then
return false
elseif brick.Parent.ClassName=="Hat" then
return false
elseif brick:IsDescendantOf(sp.Parent) then
return false
elseif brick.Name=="Handle" then
if brick.Parent:IsDescendantOf(sp.Parent) then
return false
else
return true
end
end
return true
end)
bullet.Parent=game.Workspace
bt2.Parent=game.Workspace
if hit~=nil then
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid~=nil then
local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
if hit.Name=="Head" then
damage=damage*1.25
elseif hit.Name=="Torso" then
else
damage=damage*.75
end
if humanoid.Health>0 then
local eplr=game.Players:playerFromCharacter(humanoid.Parent)
local plr=game.Players:playerFromCharacter(sp.Parent)
if eplr~=nil and plr~=nil then
-- if eplr.TeamColor~=plr.TeamColor or eplr.Neutral or plr.Neutral then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
sp.Neutral.Texture = "http://www.roblox.com/asset/?id=53455287"
sp.Friendly.Texture = "http://www.roblox.com/asset/?id=53455282"
sp.Enemy.Texture = "http://www.roblox.com/asset/?id=53455310"
wait(0.01)
sp.Neutral.Texture = "http://www.roblox.com/asset/?id=51962380"
sp.Friendly.Texture = "http://www.roblox.com/asset/?id=51962541"
sp.Enemy.Texture = "http://www.roblox.com/asset/?id=51962534"
-- end
else
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
sp.Neutral.Texture = "http://www.roblox.com/asset/?id=53455287"
sp.Friendly.Texture = "http://www.roblox.com/asset/?id=53455282"
sp.Enemy.Texture = "http://www.roblox.com/asset/?id=53455310"
wait(0.01)
sp.Neutral.Texture = "http://www.roblox.com/asset/?id=51962380"
sp.Friendly.Texture = "http://www.roblox.com/asset/?id=51962541"
sp.Enemy.Texture = "http://www.roblox.com/asset/?id=51962534"
end
end
end
if (hit.Name == "Ice") or (hit.Name == "Glass") then
rand = math.random(1,5)
if rand == 3 then
workspace.GlassSound:play()
hit:breakJoints()
end
end
if (hit.Parent:findFirstChild("Hit")) then
hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/20
end
distance=(startpoint-pos).magnitude
bullet.CFrame=cfrm*CFrame.new(0,0,-distance/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,distance)
else
bullet.CFrame=cfrm*CFrame.new(0,0,-RayLength/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,RayLength)
end
if pos~=nil then
bt2.CFrame=bullet.CFrame
movecframe(bt2,pos)
end
local deb=game:FindFirstChild("Debris")
if deb==nil then
local debris=Instance.new("Debris")
debris.Parent=game
end
check()
game.Debris:AddItem(bullet,.05)
game.Debris:AddItem(bt2,.5)
end
function onButton1Up(mouse)
down=false
end
function onButton1Down(mouse)
h=sp.Parent:FindFirstChild("Humanoid")
if not enabled or reloading or down or h==nil then
return
end
if sp.Ammo.Value>0 and h.Health>0 then
--[[if sp.Ammo.Value<=0 then
if not reloading then
reload(mouse)
end
return
end]]
down=true
enabled=false
while down do
if sp.Ammo.Value<=0 then
break
end
if burst then
local startpoint=sp.Barrel.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag))
fire(mouse.Hit.p+rndm)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
local startpoint=sp.Barrel.CFrame*BarrlePos
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
fire(mouse.Hit.p+rndm+rndm2+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
elseif shot then
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=sp.Barrel.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag))
fire(mouse.Hit.p+rndm)
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm3)
local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm4)
else
local startpoint=sp.Barrel.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag),math.random(-(script.Parent.Spread.Value/10)*mag,(script.Parent.Spread.Value/10)*mag))
fire(mouse.Hit.p+rndm)
weld2.C1 = CFrame.new(-1.6, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-70), -0.06) --(forwards/backwards,
wait(0.05)
weld2.C1 = CFrame.new(-1.3, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-75), -0.04) --(forwards/backwards,
wait(0.05)
weld2.C1 = CFrame.new(-1, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(-90), 0) --(forwards/backwards,
end
wait(Firerate)
if not automatic then
break
end
end
enabled=true
else
sp.Handle.Trigger:Play()
sp.GripForward = Vector3.new(-0.243, -0.1, -0.97)
wait(0.1)
sp.GripForward = Vector3.new(-0.243, 0, -0.97)
end
end
function onEquippedLocal(mouse)
if mouse==nil then
print("Mouse not found")
return
end
mouse.Icon=Cursors[1]
mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
check()
equiped=true
if #Cursors>1 then
while equiped do
t=r.Stepped:wait()
local action=sp.Parent:FindFirstChild("Pose")
if action~=nil then
if sp.Parent.Pose.Value=="Standing" then
Spread=MinSpread
else
Spread=MinSpread+((4/10)*(MaxSpread-MinSpread))
end
else
Spread=MinSpread
end
if t-last<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last2<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last3<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last4<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last5<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last6<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if not reloading then
local percent=(Spread-MinSpread)/(MaxSpread-MinSpread)
for i=0,#Cursors-1 do
if percent>(i/(#Cursors-1))-((1/(#Cursors-1))/2) and percent<(i/(#Cursors-1))+((1/(#Cursors-1))/2) then
mouse.Icon=Cursors[i+1]
end
end
end
wait(Firerate*.9)
end
end
end
function onUnequippedLocal(mouse)
equiped=false
reloading=false
sp.Neutral.Texture = "http://www.roblox.com/asset/?id=51962380"
sp.Friendly.Texture = "http://www.roblox.com/asset/?id=51962541"
sp.Enemy.Texture = "http://www.roblox.com/asset/?id=51962534"
sp.Spread = 0
sp.Parent.Humanoid.WalkSpeed = 16
ADS = 0
run = 0
end
sp.Equipped:connect(onEquippedLocal)
sp.Unequipped:connect(onUnequippedLocal)
check()
end))
Part88.Parent = Tool81
Part88.Material = Enum.Material.Metal
Part88.BrickColor = BrickColor.new("Black")
Part88.Rotation = Vector3.new(-90, 0, 71.0699997)
Part88.FormFactor = Enum.FormFactor.Custom
Part88.Size = Vector3.new(0.25, 0.200000003, 0.25)
Part88.CFrame = CFrame.new(13.3802023, 4.75810814, 0.172626004, 0.324368834, -0.94593066, -2.31046888e-05, 1.00436482e-05, -2.09812824e-05, 1, -0.94593066, -0.324368864, 2.69492193e-06)
Part88.BottomSurface = Enum.SurfaceType.Smooth
Part88.TopSurface = Enum.SurfaceType.Smooth
Part88.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part88.Position = Vector3.new(13.3802023, 4.75810814, 0.172626004)
Part88.Orientation = Vector3.new(-90, 71.0699997, 0)
Part88.Color = Color3.new(0.105882, 0.164706, 0.207843)
CylinderMesh89.Parent = Part88
CylinderMesh89.Scale = Vector3.new(3, 0.75, 3)
CylinderMesh89.Scale = Vector3.new(3, 0.75, 3)
Part90.Name = "GlassPart"
Part90.Parent = Tool81
Part90.Material = Enum.Material.Glass
Part90.BrickColor = BrickColor.new("Institutional white")
Part90.Transparency = 0.5
Part90.Rotation = Vector3.new(0, -37.8499985, 0)
Part90.FormFactor = Enum.FormFactor.Custom
Part90.Size = Vector3.new(0.400000006, 2, 0.200000003)
Part90.CFrame = CFrame.new(11.3907623, 3.37725711, -0.318569005, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part90.BottomSurface = Enum.SurfaceType.Smooth
Part90.TopSurface = Enum.SurfaceType.Smooth
Part90.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part90.Position = Vector3.new(11.3907623, 3.37725711, -0.318569005)
Part90.Orientation = Vector3.new(0, -37.8499985, 0)
Part90.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh91.Parent = Part90
BlockMesh91.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh91.Scale = Vector3.new(1, 1, 0)
BlockMesh91.Scale = Vector3.new(1, 1, 0)
Part92.Name = "GlassPart"
Part92.Parent = Tool81
Part92.Material = Enum.Material.Glass
Part92.BrickColor = BrickColor.new("Institutional white")
Part92.Transparency = 0.5
Part92.Rotation = Vector3.new(-180, -90, 0)
Part92.FormFactor = Enum.FormFactor.Custom
Part92.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
Part92.CFrame = CFrame.new(14.1699362, 2.27702403, 0.649676979, -0.000118972122, -4.31590597e-05, -1, 2.79581602e-09, -1, 4.31590597e-05, -0.99999994, 2.33890907e-09, 0.00011897213)
Part92.BottomSurface = Enum.SurfaceType.Smooth
Part92.TopSurface = Enum.SurfaceType.Smooth
Part92.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part92.Position = Vector3.new(14.1699362, 2.27702403, 0.649676979)
Part92.Orientation = Vector3.new(0, -89.9899979, 180)
Part92.Color = Color3.new(0.972549, 0.972549, 0.972549)
SpecialMesh93.Parent = Part92
SpecialMesh93.Scale = Vector3.new(0, 1, 1)
SpecialMesh93.MeshType = Enum.MeshType.Wedge
SpecialMesh93.Scale = Vector3.new(0, 1, 1)
Part94.Parent = Tool81
Part94.Material = Enum.Material.Metal
Part94.BrickColor = BrickColor.new("Black")
Part94.Rotation = Vector3.new(0, -28.3899994, 0)
Part94.FormFactor = Enum.FormFactor.Custom
Part94.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part94.CFrame = CFrame.new(11.9849997, 6.51584816, 0.0920599997, 0.879726708, 3.70690686e-05, -0.475472778, -2.21015525e-05, 1, 3.70690686e-05, 0.475472778, -2.21015525e-05, 0.879726708)
Part94.BottomSurface = Enum.SurfaceType.Smooth
Part94.TopSurface = Enum.SurfaceType.Smooth
Part94.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part94.Position = Vector3.new(11.9849997, 6.51584816, 0.0920599997)
Part94.Orientation = Vector3.new(0, -28.3899994, 0)
Part94.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh95.Parent = Part94
BlockMesh95.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh95.Scale = Vector3.new(1, 0.5, 0.5)
Part96.Parent = Tool81
Part96.Material = Enum.Material.Metal
Part96.BrickColor = BrickColor.new("Black")
Part96.Rotation = Vector3.new(0, -37.8400002, 135)
Part96.FormFactor = Enum.FormFactor.Custom
Part96.Size = Vector3.new(0.200000003, 0.400000006, 0.200000003)
Part96.CFrame = CFrame.new(11.2934103, 6.38909388, -0.394008994, -0.558394432, -0.558437765, -0.613467932, 0.707113028, -0.707100511, 3.85237654e-05, -0.433805048, -0.433769733, 0.789719641)
Part96.BottomSurface = Enum.SurfaceType.Smooth
Part96.TopSurface = Enum.SurfaceType.Smooth
Part96.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part96.Position = Vector3.new(11.2934103, 6.38909388, -0.394008994)
Part96.Orientation = Vector3.new(0, -37.8400002, 135)
Part96.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh97.Parent = Part96
BlockMesh97.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh97.Scale = Vector3.new(0.5, 1, 0.5)
Part98.Parent = Tool81
Part98.Material = Enum.Material.Metal
Part98.BrickColor = BrickColor.new("Black")
Part98.Rotation = Vector3.new(0, -37.8499985, 0)
Part98.FormFactor = Enum.FormFactor.Custom
Part98.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part98.CFrame = CFrame.new(11.5745382, 6.51584816, -0.175518006, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part98.BottomSurface = Enum.SurfaceType.Smooth
Part98.TopSurface = Enum.SurfaceType.Smooth
Part98.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part98.Position = Vector3.new(11.5745382, 6.51584816, -0.175518006)
Part98.Orientation = Vector3.new(0, -37.8499985, 0)
Part98.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh99.Parent = Part98
BlockMesh99.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh99.Scale = Vector3.new(1, 0.5, 0.5)
Part100.Name = "GlassPart"
Part100.Parent = Tool81
Part100.Material = Enum.Material.Glass
Part100.BrickColor = BrickColor.new("Institutional white")
Part100.Transparency = 0.5
Part100.Rotation = Vector3.new(0, -37.8499985, 0)
Part100.FormFactor = Enum.FormFactor.Custom
Part100.Size = Vector3.new(0.200000003, 0.223500013, 0.200000003)
Part100.CFrame = CFrame.new(11.4696798, 6.3552742, -0.257061005, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part100.BottomSurface = Enum.SurfaceType.Smooth
Part100.TopSurface = Enum.SurfaceType.Smooth
Part100.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part100.Position = Vector3.new(11.4696798, 6.3552742, -0.257061005)
Part100.Orientation = Vector3.new(0, -37.8499985, 0)
Part100.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh101.Parent = Part100
BlockMesh101.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh101.Scale = Vector3.new(1, 1, 0)
BlockMesh101.Scale = Vector3.new(1, 1, 0)
Part102.Name = "GlassPart"
Part102.Parent = Tool81
Part102.Material = Enum.Material.Glass
Part102.BrickColor = BrickColor.new("Institutional white")
Part102.Transparency = 0.5
Part102.Rotation = Vector3.new(90, 0.00999999978, 127.839996)
Part102.FormFactor = Enum.FormFactor.Custom
Part102.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
Part102.CFrame = CFrame.new(11.2810202, 6.34355021, -0.340312988, -0.613507092, -0.789689183, 0.000104060433, -8.34418415e-07, -0.000131125649, -1, 0.789689183, -0.613507152, 7.97875909e-05)
Part102.BottomSurface = Enum.SurfaceType.Smooth
Part102.TopSurface = Enum.SurfaceType.Smooth
Part102.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part102.Position = Vector3.new(11.2810202, 6.34355021, -0.340312988)
Part102.Orientation = Vector3.new(90, -127.839996, 0)
Part102.Color = Color3.new(0.972549, 0.972549, 0.972549)
SpecialMesh103.Parent = Part102
SpecialMesh103.Scale = Vector3.new(0, 1, 1)
SpecialMesh103.MeshType = Enum.MeshType.Wedge
SpecialMesh103.Scale = Vector3.new(0, 1, 1)
Part104.Name = "GlassPart"
Part104.Parent = Tool81
Part104.Material = Enum.Material.Glass
Part104.BrickColor = BrickColor.new("Institutional white")
Part104.Transparency = 0.5
Part104.Rotation = Vector3.new(0, -37.8499985, 0)
Part104.FormFactor = Enum.FormFactor.Custom
Part104.Size = Vector3.new(0.400000006, 1.06050003, 0.200000003)
Part104.CFrame = CFrame.new(11.3907003, 5.71331215, -0.318569005, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part104.BottomSurface = Enum.SurfaceType.Smooth
Part104.TopSurface = Enum.SurfaceType.Smooth
Part104.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part104.Position = Vector3.new(11.3907003, 5.71331215, -0.318569005)
Part104.Orientation = Vector3.new(0, -37.8499985, 0)
Part104.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh105.Parent = Part104
BlockMesh105.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh105.Scale = Vector3.new(1, 1, 0)
BlockMesh105.Scale = Vector3.new(1, 1, 0)
Part106.Name = "GlassPart"
Part106.Parent = Tool81
Part106.Material = Enum.Material.Glass
Part106.BrickColor = BrickColor.new("Institutional white")
Part106.Transparency = 0.5
Part106.Rotation = Vector3.new(0, -28.3899994, 0)
Part106.FormFactor = Enum.FormFactor.Custom
Part106.Size = Vector3.new(0.5, 1.29999995, 0.200000003)
Part106.CFrame = CFrame.new(11.761672, 5.8180418, -0.0815239996, 0.879726708, 3.70690686e-05, -0.475472778, -2.21015525e-05, 1, 3.70690686e-05, 0.475472778, -2.21015525e-05, 0.879726708)
Part106.BottomSurface = Enum.SurfaceType.Smooth
Part106.TopSurface = Enum.SurfaceType.Smooth
Part106.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part106.Position = Vector3.new(11.761672, 5.8180418, -0.0815239996)
Part106.Orientation = Vector3.new(0, -28.3899994, 0)
Part106.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh107.Parent = Part106
BlockMesh107.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh107.Scale = Vector3.new(1, 1, 0)
BlockMesh107.Scale = Vector3.new(1, 1, 0)
Part108.Parent = Tool81
Part108.Material = Enum.Material.Metal
Part108.BrickColor = BrickColor.new("Black")
Part108.Rotation = Vector3.new(0, -9.46000004, 0)
Part108.FormFactor = Enum.FormFactor.Custom
Part108.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part108.CFrame = CFrame.new(13.3487082, 6.51590919, 0.559585989, 0.986395717, 3.29302056e-05, -0.164386213, -2.78963325e-05, 1, 3.29302056e-05, 0.164386213, -2.78963325e-05, 0.986395717)
Part108.BottomSurface = Enum.SurfaceType.Smooth
Part108.TopSurface = Enum.SurfaceType.Smooth
Part108.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part108.Position = Vector3.new(13.3487082, 6.51590919, 0.559585989)
Part108.Orientation = Vector3.new(0, -9.46000004, 0)
Part108.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh109.Parent = Part108
BlockMesh109.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh109.Scale = Vector3.new(1, 0.5, 0.5)
Part110.Parent = Tool81
Part110.Material = Enum.Material.Metal
Part110.BrickColor = BrickColor.new("Black")
Part110.FormFactor = Enum.FormFactor.Custom
Part110.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part110.CFrame = CFrame.new(13.8371124, 6.51590919, 0.600117028, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part110.BottomSurface = Enum.SurfaceType.Smooth
Part110.TopSurface = Enum.SurfaceType.Smooth
Part110.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part110.Position = Vector3.new(13.8371124, 6.51590919, 0.600117028)
Part110.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh111.Parent = Part110
BlockMesh111.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh111.Scale = Vector3.new(1, 0.5, 0.5)
Part112.Parent = Tool81
Part112.Material = Enum.Material.Metal
Part112.BrickColor = BrickColor.new("Black")
Part112.Rotation = Vector3.new(0, -37.8499985, 0)
Part112.FormFactor = Enum.FormFactor.Custom
Part112.Size = Vector3.new(0.200000003, 1.10000002, 0.200000003)
Part112.CFrame = CFrame.new(11.1933136, 5.73304176, -0.471935004, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part112.BottomSurface = Enum.SurfaceType.Smooth
Part112.TopSurface = Enum.SurfaceType.Smooth
Part112.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part112.Position = Vector3.new(11.1933136, 5.73304176, -0.471935004)
Part112.Orientation = Vector3.new(0, -37.8499985, 0)
Part112.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh113.Parent = Part112
BlockMesh113.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh113.Scale = Vector3.new(0.5, 1, 0.5)
Part114.Parent = Tool81
Part114.Material = Enum.Material.Metal
Part114.BrickColor = BrickColor.new("Black")
Part114.Rotation = Vector3.new(0, -18.9300003, 0)
Part114.FormFactor = Enum.FormFactor.Custom
Part114.Size = Vector3.new(0.966000438, 0.200000003, 0.200000003)
Part114.CFrame = CFrame.new(12.6531525, 6.51590919, 0.364033014, 0.945934772, 3.51197777e-05, -0.324356169, -2.50846242e-05, 1, 3.51197777e-05, 0.324356169, -2.50846242e-05, 0.945934772)
Part114.BottomSurface = Enum.SurfaceType.Smooth
Part114.TopSurface = Enum.SurfaceType.Smooth
Part114.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part114.Position = Vector3.new(12.6531525, 6.51590919, 0.364033014)
Part114.Orientation = Vector3.new(0, -18.9300003, 0)
Part114.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh115.Parent = Part114
BlockMesh115.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh115.Scale = Vector3.new(1, 0.5, 0.5)
Part116.Name = "GlassPart"
Part116.Parent = Tool81
Part116.Material = Enum.Material.Glass
Part116.BrickColor = BrickColor.new("Institutional white")
Part116.Transparency = 0.5
Part116.Rotation = Vector3.new(0, -90, 0)
Part116.FormFactor = Enum.FormFactor.Custom
Part116.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
Part116.CFrame = CFrame.new(14.1699362, 6.34361982, 0.64991802, -3.26636837e-05, 4.31581502e-05, -1, 9.29513244e-10, 1, 4.31581502e-05, 0.99999994, 4.80190998e-10, -3.26636873e-05)
Part116.BottomSurface = Enum.SurfaceType.Smooth
Part116.TopSurface = Enum.SurfaceType.Smooth
Part116.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part116.Position = Vector3.new(14.1699362, 6.34361982, 0.64991802)
Part116.Orientation = Vector3.new(0, -90, 0)
Part116.Color = Color3.new(0.972549, 0.972549, 0.972549)
SpecialMesh117.Parent = Part116
SpecialMesh117.Scale = Vector3.new(0, 1, 1)
SpecialMesh117.MeshType = Enum.MeshType.Wedge
SpecialMesh117.Scale = Vector3.new(0, 1, 1)
Part118.Name = "GlassPart"
Part118.Parent = Tool81
Part118.Material = Enum.Material.Glass
Part118.BrickColor = BrickColor.new("Institutional white")
Part118.Transparency = 0.5
Part118.Rotation = Vector3.new(0, -18.9200001, 0)
Part118.FormFactor = Enum.FormFactor.Custom
Part118.Size = Vector3.new(1.5, 1.29999995, 0.200000003)
Part118.CFrame = CFrame.new(12.6835442, 5.81983423, 0.277363002, 0.945954859, -3.51188464e-05, -0.324295938, 2.50855555e-05, 1, -3.51188464e-05, 0.324295938, 2.50855555e-05, 0.945954859)
Part118.BottomSurface = Enum.SurfaceType.Smooth
Part118.TopSurface = Enum.SurfaceType.Smooth
Part118.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part118.Position = Vector3.new(12.6835442, 5.81983423, 0.277363002)
Part118.Orientation = Vector3.new(0, -18.9200001, 0)
Part118.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh119.Parent = Part118
BlockMesh119.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh119.Scale = Vector3.new(1, 1, 0)
BlockMesh119.Scale = Vector3.new(1, 1, 0)
Part120.Parent = Tool81
Part120.Material = Enum.Material.Metal
Part120.BrickColor = BrickColor.new("Black")
Part120.Rotation = Vector3.new(0, 0, -135)
Part120.FormFactor = Enum.FormFactor.Custom
Part120.Size = Vector3.new(0.200000003, 0.400000006, 0.200000003)
Part120.CFrame = CFrame.new(14.1931915, 6.38920021, 0.600117028, -0.707149565, 0.707063973, 7.29076783e-05, -0.707063973, -0.707149565, 6.32290612e-05, 9.62636259e-05, -6.83798817e-06, 1)
Part120.BottomSurface = Enum.SurfaceType.Smooth
Part120.TopSurface = Enum.SurfaceType.Smooth
Part120.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part120.Position = Vector3.new(14.1931915, 6.38920021, 0.600117028)
Part120.Orientation = Vector3.new(0, 0, -135)
Part120.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh121.Parent = Part120
BlockMesh121.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh121.Scale = Vector3.new(0.5, 1, 0.5)
Part122.Name = "GlassPart"
Part122.Parent = Tool81
Part122.Material = Enum.Material.Glass
Part122.BrickColor = BrickColor.new("Institutional white")
Part122.Transparency = 0.5
Part122.FormFactor = Enum.FormFactor.Custom
Part122.Size = Vector3.new(0.200000003, 0.223500013, 0.200000003)
Part122.CFrame = CFrame.new(13.969986, 6.35533524, 0.600117028, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part122.BottomSurface = Enum.SurfaceType.Smooth
Part122.TopSurface = Enum.SurfaceType.Smooth
Part122.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part122.Position = Vector3.new(13.969986, 6.35533524, 0.600117028)
Part122.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh123.Parent = Part122
BlockMesh123.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh123.Scale = Vector3.new(1, 1, 0)
BlockMesh123.Scale = Vector3.new(1, 1, 0)
Part124.Name = "GlassPart"
Part124.Parent = Tool81
Part124.Material = Enum.Material.Glass
Part124.BrickColor = BrickColor.new("Institutional white")
Part124.Transparency = 0.5
Part124.FormFactor = Enum.FormFactor.Custom
Part124.Size = Vector3.new(0.400000006, 1.06050014, 0.200000003)
Part124.CFrame = CFrame.new(14.0699615, 5.71336222, 0.600117028, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part124.BottomSurface = Enum.SurfaceType.Smooth
Part124.TopSurface = Enum.SurfaceType.Smooth
Part124.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part124.Position = Vector3.new(14.0699615, 5.71336222, 0.600117028)
Part124.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh125.Parent = Part124
BlockMesh125.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh125.Scale = Vector3.new(1, 1, 0)
BlockMesh125.Scale = Vector3.new(1, 1, 0)
Part126.Name = "Barrel"
Part126.Parent = Tool81
Part126.Material = Enum.Material.Metal
Part126.BrickColor = BrickColor.new("Black")
Part126.Rotation = Vector3.new(0, -18.9200001, 0)
Part126.FormFactor = Enum.FormFactor.Custom
Part126.Size = Vector3.new(1.5, 0.850000024, 0.200000003)
Part126.CFrame = CFrame.new(12.6835442, 4.75803518, 0.277363002, 0.945954859, -3.51188464e-05, -0.324295938, 2.50855555e-05, 1, -3.51188464e-05, 0.324295938, 2.50855555e-05, 0.945954859)
Part126.BottomSurface = Enum.SurfaceType.Smooth
Part126.TopSurface = Enum.SurfaceType.Smooth
Part126.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part126.Position = Vector3.new(12.6835442, 4.75803518, 0.277363002)
Part126.Orientation = Vector3.new(0, -18.9200001, 0)
Part126.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh127.Parent = Part126
BlockMesh127.Scale = Vector3.new(1, 1, 0.5)
BlockMesh127.Scale = Vector3.new(1, 1, 0.5)
Decal128.Parent = Part126
Decal128.Texture = "http://www.roblox.com/asset/?id=156639788"
Decal128.Face = Enum.NormalId.Back
Part129.Parent = Tool81
Part129.Material = Enum.Material.Metal
Part129.BrickColor = BrickColor.new("Black")
Part129.Rotation = Vector3.new(0, -28.3899994, 0)
Part129.FormFactor = Enum.FormFactor.Custom
Part129.Size = Vector3.new(0.5, 0.850000024, 0.200000003)
Part129.CFrame = CFrame.new(11.761734, 4.75803518, -0.0815239996, 0.879726708, 3.70690686e-05, -0.475472778, -2.21015525e-05, 1, 3.70690686e-05, 0.475472778, -2.21015525e-05, 0.879726708)
Part129.BottomSurface = Enum.SurfaceType.Smooth
Part129.TopSurface = Enum.SurfaceType.Smooth
Part129.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part129.Position = Vector3.new(11.761734, 4.75803518, -0.0815239996)
Part129.Orientation = Vector3.new(0, -28.3899994, 0)
Part129.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh130.Parent = Part129
BlockMesh130.Scale = Vector3.new(1, 1, 0.5)
BlockMesh130.Scale = Vector3.new(1, 1, 0.5)
Part131.Parent = Tool81
Part131.Material = Enum.Material.Metal
Part131.BrickColor = BrickColor.new("Black")
Part131.Rotation = Vector3.new(-90, 0, 71.0699997)
Part131.FormFactor = Enum.FormFactor.Custom
Part131.Size = Vector3.new(0.25, 0.200000003, 0.25)
Part131.CFrame = CFrame.new(12.1975861, 4.75803518, -0.232890993, 0.324368834, -0.94593066, -2.31046888e-05, 1.00436482e-05, -2.09812824e-05, 1, -0.94593066, -0.324368864, 2.69492193e-06)
Part131.BottomSurface = Enum.SurfaceType.Smooth
Part131.TopSurface = Enum.SurfaceType.Smooth
Part131.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part131.Position = Vector3.new(12.1975861, 4.75803518, -0.232890993)
Part131.Orientation = Vector3.new(-90, 71.0699997, 0)
Part131.Color = Color3.new(0.105882, 0.164706, 0.207843)
CylinderMesh132.Parent = Part131
CylinderMesh132.Scale = Vector3.new(3, 0.75, 3)
CylinderMesh132.Scale = Vector3.new(3, 0.75, 3)
Part133.Parent = Tool81
Part133.Material = Enum.Material.Metal
Part133.BrickColor = BrickColor.new("Black")
Part133.Rotation = Vector3.new(0, -37.8499985, 0)
Part133.FormFactor = Enum.FormFactor.Custom
Part133.Size = Vector3.new(0.5, 0.850000024, 0.200000003)
Part133.CFrame = CFrame.new(11.3512716, 4.75803518, -0.34910199, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part133.BottomSurface = Enum.SurfaceType.Smooth
Part133.TopSurface = Enum.SurfaceType.Smooth
Part133.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part133.Position = Vector3.new(11.3512716, 4.75803518, -0.34910199)
Part133.Orientation = Vector3.new(0, -37.8499985, 0)
Part133.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh134.Parent = Part133
BlockMesh134.Scale = Vector3.new(1, 1, 0.5)
BlockMesh134.Scale = Vector3.new(1, 1, 0.5)
Part135.Name = "GlassPart"
Part135.Parent = Tool81
Part135.Material = Enum.Material.Glass
Part135.BrickColor = BrickColor.new("Institutional white")
Part135.Transparency = 0.5
Part135.Rotation = Vector3.new(0, -9.46000004, 0)
Part135.FormFactor = Enum.FormFactor.Custom
Part135.Size = Vector3.new(0.5, 1.29999995, 0.200000003)
Part135.CFrame = CFrame.new(13.6316061, 5.81809902, 0.559585989, 0.986395717, 3.29302056e-05, -0.164386213, -2.78963325e-05, 1, 3.29302056e-05, 0.164386213, -2.78963325e-05, 0.986395717)
Part135.BottomSurface = Enum.SurfaceType.Smooth
Part135.TopSurface = Enum.SurfaceType.Smooth
Part135.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part135.Position = Vector3.new(13.6316061, 5.81809902, 0.559585989)
Part135.Orientation = Vector3.new(0, -9.46000004, 0)
Part135.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh136.Parent = Part135
BlockMesh136.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh136.Scale = Vector3.new(1, 1, 0)
BlockMesh136.Scale = Vector3.new(1, 1, 0)
Part137.Parent = Tool81
Part137.Material = Enum.Material.Metal
Part137.BrickColor = BrickColor.new("Black")
Part137.FormFactor = Enum.FormFactor.Custom
Part137.Size = Vector3.new(0.200000003, 1.10000002, 0.200000003)
Part137.CFrame = CFrame.new(14.3199615, 5.73314905, 0.600117028, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part137.BottomSurface = Enum.SurfaceType.Smooth
Part137.TopSurface = Enum.SurfaceType.Smooth
Part137.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part137.Position = Vector3.new(14.3199615, 5.73314905, 0.600117028)
Part137.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh138.Parent = Part137
BlockMesh138.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh138.Scale = Vector3.new(0.5, 1, 0.5)
Part139.Parent = Tool81
Part139.Material = Enum.Material.Metal
Part139.BrickColor = BrickColor.new("Black")
Part139.Rotation = Vector3.new(0, -9.46000004, 0)
Part139.FormFactor = Enum.FormFactor.Custom
Part139.Size = Vector3.new(0.5, 0.850000024, 0.200000003)
Part139.CFrame = CFrame.new(13.6316061, 4.75810814, 0.559585989, 0.986395717, 3.29302056e-05, -0.164386213, -2.78963325e-05, 1, 3.29302056e-05, 0.164386213, -2.78963325e-05, 0.986395717)
Part139.BottomSurface = Enum.SurfaceType.Smooth
Part139.TopSurface = Enum.SurfaceType.Smooth
Part139.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part139.Position = Vector3.new(13.6316061, 4.75810814, 0.559585989)
Part139.Orientation = Vector3.new(0, -9.46000004, 0)
Part139.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh140.Parent = Part139
BlockMesh140.Scale = Vector3.new(1, 1, 0.5)
BlockMesh140.Scale = Vector3.new(1, 1, 0.5)
Part141.Parent = Tool81
Part141.Material = Enum.Material.Metal
Part141.BrickColor = BrickColor.new("Black")
Part141.Rotation = Vector3.new(0, -37.8499985, 0)
Part141.FormFactor = Enum.FormFactor.Custom
Part141.Size = Vector3.new(0.200000003, 2, 0.200000003)
Part141.CFrame = CFrame.new(11.1933403, 3.3330729, -0.471935004, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part141.BottomSurface = Enum.SurfaceType.Smooth
Part141.TopSurface = Enum.SurfaceType.Smooth
Part141.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part141.Position = Vector3.new(11.1933403, 3.3330729, -0.471935004)
Part141.Orientation = Vector3.new(0, -37.8499985, 0)
Part141.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh142.Parent = Part141
BlockMesh142.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh142.Scale = Vector3.new(0.5, 1, 0.5)
Part143.Name = "GlassPart"
Part143.Parent = Tool81
Part143.Material = Enum.Material.Glass
Part143.BrickColor = BrickColor.new("Institutional white")
Part143.Transparency = 0.5
Part143.FormFactor = Enum.FormFactor.Custom
Part143.Size = Vector3.new(0.200000003, 0.223500013, 0.200000003)
Part143.CFrame = CFrame.new(13.9701042, 2.26522803, 0.599873006, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part143.BottomSurface = Enum.SurfaceType.Smooth
Part143.TopSurface = Enum.SurfaceType.Smooth
Part143.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part143.Position = Vector3.new(13.9701042, 2.26522803, 0.599873006)
Part143.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh144.Parent = Part143
BlockMesh144.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh144.Scale = Vector3.new(1, 1, 0)
BlockMesh144.Scale = Vector3.new(1, 1, 0)
Part145.Parent = Tool81
Part145.Material = Enum.Material.Metal
Part145.BrickColor = BrickColor.new("Black")
Part145.Rotation = Vector3.new(90.0099945, -45.0099983, 90)
Part145.FormFactor = Enum.FormFactor.Custom
Part145.Size = Vector3.new(0.200000003, 0.200000003, 0.400000006)
Part145.CFrame = CFrame.new(14.1933136, 2.22689891, 0.599873006, -1.09672546e-05, -0.707021356, -0.707198203, -9.6231699e-05, 0.707193971, -0.707021356, 1.00000417, 6.32703304e-05, -7.7009201e-05)
Part145.BottomSurface = Enum.SurfaceType.Smooth
Part145.TopSurface = Enum.SurfaceType.Smooth
Part145.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part145.Position = Vector3.new(14.1933136, 2.22689891, 0.599873006)
Part145.Orientation = Vector3.new(44.9899979, -90.0099945, -0.00999999978)
Part145.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh146.Parent = Part145
BlockMesh146.Scale = Vector3.new(0.5, 0.5, 1)
BlockMesh146.Scale = Vector3.new(0.5, 0.5, 1)
Part147.Parent = Tool81
Part147.Material = Enum.Material.Metal
Part147.BrickColor = BrickColor.new("Black")
Part147.FormFactor = Enum.FormFactor.Custom
Part147.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part147.CFrame = CFrame.new(13.8372335, 2.10008693, 0.599873006, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part147.BottomSurface = Enum.SurfaceType.Smooth
Part147.TopSurface = Enum.SurfaceType.Smooth
Part147.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part147.Position = Vector3.new(13.8372335, 2.10008693, 0.599873006)
Part147.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh148.Parent = Part147
BlockMesh148.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh148.Scale = Vector3.new(1, 0.5, 0.5)
Part149.Parent = Tool81
Part149.Material = Enum.Material.Metal
Part149.BrickColor = BrickColor.new("Black")
Part149.Rotation = Vector3.new(0, -18.9300003, 0)
Part149.FormFactor = Enum.FormFactor.Custom
Part149.Size = Vector3.new(0.965000272, 0.200000003, 0.200000003)
Part149.CFrame = CFrame.new(12.6539459, 2.10004497, 0.364033014, 0.945934772, 3.51197777e-05, -0.324356169, -2.50846242e-05, 1, 3.51197777e-05, 0.324356169, -2.50846242e-05, 0.945934772)
Part149.BottomSurface = Enum.SurfaceType.Smooth
Part149.TopSurface = Enum.SurfaceType.Smooth
Part149.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part149.Position = Vector3.new(12.6539459, 2.10004497, 0.364033014)
Part149.Orientation = Vector3.new(0, -18.9300003, 0)
Part149.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh150.Parent = Part149
BlockMesh150.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh150.Scale = Vector3.new(1, 0.5, 0.5)
Part151.Name = "GlassPart"
Part151.Parent = Tool81
Part151.Material = Enum.Material.Glass
Part151.BrickColor = BrickColor.new("Institutional white")
Part151.Transparency = 0.5
Part151.Rotation = Vector3.new(0, -9.46000004, 0)
Part151.FormFactor = Enum.FormFactor.Custom
Part151.Size = Vector3.new(0.5, 2.20000005, 0.200000003)
Part151.CFrame = CFrame.new(13.6316643, 3.24810004, 0.559585989, 0.986395717, 3.29302056e-05, -0.164386213, -2.78963325e-05, 1, 3.29302056e-05, 0.164386213, -2.78963325e-05, 0.986395717)
Part151.BottomSurface = Enum.SurfaceType.Smooth
Part151.TopSurface = Enum.SurfaceType.Smooth
Part151.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part151.Position = Vector3.new(13.6316643, 3.24810004, 0.559585989)
Part151.Orientation = Vector3.new(0, -9.46000004, 0)
Part151.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh152.Parent = Part151
BlockMesh152.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh152.Scale = Vector3.new(1, 1, 0)
BlockMesh152.Scale = Vector3.new(1, 1, 0)
Part153.Name = "GlassPart"
Part153.Parent = Tool81
Part153.Material = Enum.Material.Glass
Part153.BrickColor = BrickColor.new("Institutional white")
Part153.Transparency = 0.5
Part153.Rotation = Vector3.new(0, -37.8499985, 0)
Part153.FormFactor = Enum.FormFactor.Custom
Part153.Size = Vector3.new(0.200000003, 0.223500013, 0.200000003)
Part153.CFrame = CFrame.new(11.4698019, 2.26519895, -0.257304996, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part153.BottomSurface = Enum.SurfaceType.Smooth
Part153.TopSurface = Enum.SurfaceType.Smooth
Part153.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part153.Position = Vector3.new(11.4698019, 2.26519895, -0.257304996)
Part153.Orientation = Vector3.new(0, -37.8499985, 0)
Part153.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh154.Parent = Part153
BlockMesh154.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh154.Scale = Vector3.new(1, 1, 0)
BlockMesh154.Scale = Vector3.new(1, 1, 0)
Part155.Parent = Tool81
Part155.Material = Enum.Material.Metal
Part155.BrickColor = BrickColor.new("Black")
Part155.Rotation = Vector3.new(0, -37.8499985, 0)
Part155.FormFactor = Enum.FormFactor.Custom
Part155.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part155.CFrame = CFrame.new(11.5747223, 2.10004497, -0.175761998, 0.789619446, 3.87650289e-05, -0.61358273, -1.89694674e-05, 1, 3.87650289e-05, 0.61358273, -1.89694674e-05, 0.789619446)
Part155.BottomSurface = Enum.SurfaceType.Smooth
Part155.TopSurface = Enum.SurfaceType.Smooth
Part155.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part155.Position = Vector3.new(11.5747223, 2.10004497, -0.175761998)
Part155.Orientation = Vector3.new(0, -37.8499985, 0)
Part155.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh156.Parent = Part155
BlockMesh156.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh156.Scale = Vector3.new(1, 0.5, 0.5)
Part157.Name = "GlassPart"
Part157.Parent = Tool81
Part157.Material = Enum.Material.Glass
Part157.BrickColor = BrickColor.new("Institutional white")
Part157.Transparency = 0.5
Part157.Rotation = Vector3.new(0, -18.9200001, 0)
Part157.FormFactor = Enum.FormFactor.Custom
Part157.Size = Vector3.new(1.5, 2.20000005, 0.200000003)
Part157.CFrame = CFrame.new(12.6836081, 3.24583912, 0.277363002, 0.945954859, -3.51188464e-05, -0.324295938, 2.50855555e-05, 1, -3.51188464e-05, 0.324295938, 2.50855555e-05, 0.945954859)
Part157.BottomSurface = Enum.SurfaceType.Smooth
Part157.TopSurface = Enum.SurfaceType.Smooth
Part157.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part157.Position = Vector3.new(12.6836081, 3.24583912, 0.277363002)
Part157.Orientation = Vector3.new(0, -18.9200001, 0)
Part157.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh158.Parent = Part157
BlockMesh158.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh158.Scale = Vector3.new(1, 1, 0)
BlockMesh158.Scale = Vector3.new(1, 1, 0)
Part159.Name = "GlassPart"
Part159.Parent = Tool81
Part159.Material = Enum.Material.Glass
Part159.BrickColor = BrickColor.new("Institutional white")
Part159.Transparency = 0.5
Part159.Rotation = Vector3.new(0, 52.1499977, 180)
Part159.FormFactor = Enum.FormFactor.Custom
Part159.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
Part159.CFrame = CFrame.new(11.2812042, 2.27716804, -0.340557009, -0.613584697, -1.39968042e-05, 0.789628863, 4.08246196e-05, -1, 1.39971562e-05, 0.789628863, 4.08247397e-05, 0.613584757)
Part159.BottomSurface = Enum.SurfaceType.Smooth
Part159.TopSurface = Enum.SurfaceType.Smooth
Part159.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part159.Position = Vector3.new(11.2812042, 2.27716804, -0.340557009)
Part159.Orientation = Vector3.new(0, 52.1499977, 180)
Part159.Color = Color3.new(0.972549, 0.972549, 0.972549)
SpecialMesh160.Parent = Part159
SpecialMesh160.Scale = Vector3.new(0, 1, 1)
SpecialMesh160.MeshType = Enum.MeshType.Wedge
SpecialMesh160.Scale = Vector3.new(0, 1, 1)
Part161.Parent = Tool81
Part161.Material = Enum.Material.Metal
Part161.BrickColor = BrickColor.new("Black")
Part161.Rotation = Vector3.new(0, -9.46000004, 0)
Part161.FormFactor = Enum.FormFactor.Custom
Part161.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part161.CFrame = CFrame.new(13.3488922, 2.10008693, 0.559585989, 0.986395717, 3.29302056e-05, -0.164386213, -2.78963325e-05, 1, 3.29302056e-05, 0.164386213, -2.78963325e-05, 0.986395717)
Part161.BottomSurface = Enum.SurfaceType.Smooth
Part161.TopSurface = Enum.SurfaceType.Smooth
Part161.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part161.Position = Vector3.new(13.3488922, 2.10008693, 0.559585989)
Part161.Orientation = Vector3.new(0, -9.46000004, 0)
Part161.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh162.Parent = Part161
BlockMesh162.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh162.Scale = Vector3.new(1, 0.5, 0.5)
Part163.Parent = Tool81
Part163.Material = Enum.Material.Metal
Part163.BrickColor = BrickColor.new("Black")
Part163.Rotation = Vector3.new(-121.529999, -33.9399986, -137.699997)
Part163.FormFactor = Enum.FormFactor.Custom
Part163.Size = Vector3.new(0.200000003, 0.200000003, 0.400000006)
Part163.CFrame = CFrame.new(11.2935324, 2.22686911, -0.394268006, -0.613650262, 0.558344007, -0.558287859, -3.65348205e-05, 0.707051158, 0.70716244, 0.789577901, 0.433970869, -0.433861732)
Part163.BottomSurface = Enum.SurfaceType.Smooth
Part163.TopSurface = Enum.SurfaceType.Smooth
Part163.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part163.Position = Vector3.new(11.2935324, 2.22686911, -0.394268006)
Part163.Orientation = Vector3.new(-45, -127.849998, 0)
Part163.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh164.Parent = Part163
BlockMesh164.Scale = Vector3.new(0.5, 0.5, 1)
BlockMesh164.Scale = Vector3.new(0.5, 0.5, 1)
Part165.Name = "GlassPart"
Part165.Parent = Tool81
Part165.Material = Enum.Material.Glass
Part165.BrickColor = BrickColor.new("Institutional white")
Part165.Transparency = 0.5
Part165.FormFactor = Enum.FormFactor.Custom
Part165.Size = Vector3.new(0.400000006, 2, 0.200000003)
Part165.CFrame = CFrame.new(14.0699615, 3.37708712, 0.599873006, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part165.BottomSurface = Enum.SurfaceType.Smooth
Part165.TopSurface = Enum.SurfaceType.Smooth
Part165.Color = Color3.new(0.972549, 0.972549, 0.972549)
Part165.Position = Vector3.new(14.0699615, 3.37708712, 0.599873006)
Part165.Color = Color3.new(0.972549, 0.972549, 0.972549)
BlockMesh166.Parent = Part165
BlockMesh166.Offset = Vector3.new(0, 0, 0.0494999997)
BlockMesh166.Scale = Vector3.new(1, 1, 0)
BlockMesh166.Scale = Vector3.new(1, 1, 0)
Part167.Parent = Tool81
Part167.Material = Enum.Material.Metal
Part167.BrickColor = BrickColor.new("Black")
Part167.FormFactor = Enum.FormFactor.Custom
Part167.Size = Vector3.new(0.200000003, 2, 0.200000003)
Part167.CFrame = CFrame.new(14.3200836, 3.3331151, 0.599873006, 1, 3.05171125e-05, -3.05161811e-05, -3.05161811e-05, 1, 3.05171125e-05, 3.05171125e-05, -3.05161811e-05, 1)
Part167.BottomSurface = Enum.SurfaceType.Smooth
Part167.TopSurface = Enum.SurfaceType.Smooth
Part167.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part167.Position = Vector3.new(14.3200836, 3.3331151, 0.599873006)
Part167.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh168.Parent = Part167
BlockMesh168.Scale = Vector3.new(0.5, 1, 0.5)
BlockMesh168.Scale = Vector3.new(0.5, 1, 0.5)
Part169.Parent = Tool81
Part169.Material = Enum.Material.Metal
Part169.BrickColor = BrickColor.new("Black")
Part169.Rotation = Vector3.new(0, -28.3899994, 0)
Part169.FormFactor = Enum.FormFactor.Custom
Part169.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part169.CFrame = CFrame.new(11.9851217, 2.10004497, 0.0920599997, 0.879726708, 3.70690686e-05, -0.475472778, -2.21015525e-05, 1, 3.70690686e-05, 0.475472778, -2.21015525e-05, 0.879726708)
Part169.BottomSurface = Enum.SurfaceType.Smooth
Part169.TopSurface = Enum.SurfaceType.Smooth
Part169.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part169.Position = Vector3.new(11.9851217, 2.10004497, 0.0920599997)
Part169.Orientation = Vector3.new(0, -28.3899994, 0)
Part169.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh170.Parent = Part169
BlockMesh170.Scale = Vector3.new(1, 0.5, 0.5)
BlockMesh170.Scale = Vector3.new(1, 0.5, 0.5)
Part171.Name = "Handle"
Part171.Parent = Tool81
Part171.Material = Enum.Material.Metal
Part171.BrickColor = BrickColor.new("Black")
Part171.Transparency = 1
Part171.Rotation = Vector3.new(-179.979996, -71.0699997, -179.98999)
Part171.FormFactor = Enum.FormFactor.Custom
Part171.Size = Vector3.new(0.25, 0.25, 1.10000002)
Part171.CFrame = CFrame.new(12.7889557, 4.75803518, -0.0302540008, -0.324365765, 7.80466871e-05, -0.945931733, -2.83790778e-05, 1, 9.22390973e-05, 0.945931733, 5.67638745e-05, -0.324365765)
Part171.BottomSurface = Enum.SurfaceType.Smooth
Part171.TopSurface = Enum.SurfaceType.Smooth
Part171.Color = Color3.new(0.105882, 0.164706, 0.207843)
Part171.Position = Vector3.new(12.7889557, 4.75803518, -0.0302540008)
Part171.Orientation = Vector3.new(-0.00999999978, -108.93, 0)
Part171.Color = Color3.new(0.105882, 0.164706, 0.207843)
BlockMesh172.Parent = Part171
Sound173.Name = "Reload"
Sound173.Parent = Part171
Sound173.Pitch = 1.2999999523163
Sound173.SoundId = "http://www.roblox.com/asset/?version=1&id=2691591"
Sound173.Volume = 0.60000002384186
Sound174.Name = "Trigger"
Sound174.Parent = Part171
Sound174.Pitch = 2
Sound174.SoundId = "rbxasset://sounds//switch.wav"
Sound174.Volume = 1
Sound175.Name = "Fire"
Sound175.Parent = Part171
Sound175.Pitch = 3
Sound175.SoundId = "http://www.roblox.com/asset/?id=10730819"
Sound175.Volume = 1
Sound175.PlayOnRemove = true
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
--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")
IntValue1 = Instance.new("IntValue")
Animation2 = Instance.new("Animation")
Part3 = Instance.new("Part")
Sound4 = Instance.new("Sound")
Sound5 = Instance.new("Sound")
Sound6 = Instance.new("Sound")
SpecialMesh7 = Instance.new("SpecialMesh")
Part8 = Instance.new("Part")
CylinderMesh9 = Instance.new("CylinderMesh")
PointLight10 = Instance.new("PointLight")
BillboardGui11 = Instance.new("BillboardGui")
ImageLabel12 = Instance.new("ImageLabel")
Part13 = Instance.new("Part")
SpecialMesh14 = Instance.new("SpecialMesh")
PointLight15 = Instance.new("PointLight")
BillboardGui16 = Instance.new("BillboardGui")
ImageLabel17 = Instance.new("ImageLabel")
Part18 = Instance.new("Part")
SpecialMesh19 = Instance.new("SpecialMesh")
PointLight20 = Instance.new("PointLight")
BillboardGui21 = Instance.new("BillboardGui")
ImageLabel22 = Instance.new("ImageLabel")
Part23 = Instance.new("Part")
SpecialMesh24 = Instance.new("SpecialMesh")
BillboardGui25 = Instance.new("BillboardGui")
ImageLabel26 = Instance.new("ImageLabel")
SurfaceLight27 = Instance.new("SurfaceLight")
Script28 = Instance.new("Script")
Script29 = Instance.new("Script")
LocalScript30 = Instance.new("LocalScript")
ScreenGui31 = Instance.new("ScreenGui")
TextLabel32 = Instance.new("TextLabel")
TextLabel33 = Instance.new("TextLabel")
Tool0.Name = "Bike"
Tool0.Parent = mas
Tool0.GripForward = Vector3.new(-0, 3.9340253e-07, -1)
Tool0.GripPos = Vector3.new(1.5, 1.10000002, -0.800000012)
Tool0.GripUp = Vector3.new(0, 1, 3.9340253e-07)
Tool0.CanBeDropped = false
IntValue1.Name = "IsReady"
IntValue1.Parent = Tool0
Animation2.Name = "holdAni"
Animation2.Parent = Tool0
Animation2.AnimationId = "http://www.roblox.com/Asset?ID=104506550"
Part3.Name = "Handle"
Part3.Parent = Tool0
Part3.Material = Enum.Material.Fabric
Part3.Elasticity = 0
Part3.FormFactor = Enum.FormFactor.Custom
Part3.Friction = 0
Part3.Size = Vector3.new(0.200000003, 5, 7.91000128)
Part3.CFrame = CFrame.new(82.3563538, 4.50000477, 70.8921051, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Part3.BottomSurface = Enum.SurfaceType.Smooth
Part3.TopSurface = Enum.SurfaceType.Smooth
Part3.Position = Vector3.new(82.3563538, 4.50000477, 70.8921051)
Sound4.Name = "Running"
Sound4.Parent = Part3
Sound4.SoundId = "rbxassetid://288319082"
Sound4.Volume = 0.30000001192093
Sound4.Looped = true
Sound5.Name = "Siren"
Sound5.Parent = Part3
Sound5.SoundId = "rbxassetid://295410986"
Sound5.Volume = 10
Sound5.Looped = true
Sound6.Name = "Siren1"
Sound6.Parent = Part3
Sound6.SoundId = "rbxassetid://295410932"
Sound6.Volume = 10
Sound6.Looped = true
SpecialMesh7.Parent = Part3
SpecialMesh7.MeshId = "rbxassetid://575950615"
SpecialMesh7.Offset = Vector3.new(0, 0, 0.300000012)
SpecialMesh7.Scale = Vector3.new(0.0700000003, 0.0700000003, 0.0700000003)
SpecialMesh7.TextureId = "rbxassetid://72012761"
SpecialMesh7.MeshType = Enum.MeshType.FileMesh
SpecialMesh7.Scale = Vector3.new(0.0700000003, 0.0700000003, 0.0700000003)
Part8.Name = "BackLight"
Part8.Parent = Tool0
Part8.Material = Enum.Material.SmoothPlastic
Part8.BrickColor = BrickColor.new("Deep blue")
Part8.Reflectance = 0.10000000149012
Part8.Transparency = 1
Part8.Rotation = Vector3.new(0, -90, 0)
Part8.CanCollide = false
Part8.FormFactor = Enum.FormFactor.Custom
Part8.Size = Vector3.new(0.400000006, 0.200000003, 0.300000012)
Part8.CFrame = CFrame.new(83.0562744, 6.18976879, 74.8003235, 0, 0, -1, 0, 1, 0, 1, 0, 0)
Part8.BottomSurface = Enum.SurfaceType.Smooth
Part8.TopSurface = Enum.SurfaceType.Smooth
Part8.Color = Color3.new(0.129412, 0.329412, 0.72549)
Part8.Position = Vector3.new(83.0562744, 6.18976879, 74.8003235)
Part8.Orientation = Vector3.new(0, -90, 0)
Part8.Color = Color3.new(0.129412, 0.329412, 0.72549)
CylinderMesh9.Parent = Part8
CylinderMesh9.Offset = Vector3.new(0, -0.0500000007, 0)
CylinderMesh9.Scale = Vector3.new(0.400000006, 0.5, 1)
CylinderMesh9.Scale = Vector3.new(0.400000006, 0.5, 1)
PointLight10.Name = "Light2"
PointLight10.Parent = Part8
PointLight10.Color = Color3.new(0, 0.666667, 1)
PointLight10.Enabled = false
PointLight10.Brightness = 5
PointLight10.Color = Color3.new(0, 0.666667, 1)
BillboardGui11.Name = "Light"
BillboardGui11.Parent = Part8
BillboardGui11.Size = UDim2.new(3, 0, 3, 0)
BillboardGui11.Enabled = false
BillboardGui11.ExtentsOffset = Vector3.new(0, 0, 1)
ImageLabel12.Name = "Light"
ImageLabel12.Parent = BillboardGui11
ImageLabel12.Transparency = 1
ImageLabel12.Size = UDim2.new(1, 0, 1, 0)
ImageLabel12.BackgroundTransparency = 1
ImageLabel12.Image = "http://www.roblox.com/asset/?id=134532208"
Part13.Name = "LeftLight"
Part13.Parent = Tool0
Part13.Material = Enum.Material.SmoothPlastic
Part13.BrickColor = BrickColor.new("Deep blue")
Part13.Reflectance = 0.10000000149012
Part13.Transparency = 1
Part13.Rotation = Vector3.new(0, 0, -180)
Part13.CanCollide = false
Part13.FormFactor = Enum.FormFactor.Custom
Part13.Size = Vector3.new(0.400000006, 0.200000003, 0.200000003)
Part13.CFrame = CFrame.new(80.9499664, 5.62722111, 68.2604904, -1, 1.25603208e-07, -1.30385143e-08, -1.43017303e-07, -1, -2.98068983e-08, 5.58794211e-09, -1.1389605e-07, 1)
Part13.BottomSurface = Enum.SurfaceType.Smooth
Part13.TopSurface = Enum.SurfaceType.Smooth
Part13.Color = Color3.new(0.129412, 0.329412, 0.72549)
Part13.Position = Vector3.new(80.9499664, 5.62722111, 68.2604904)
Part13.Orientation = Vector3.new(0, 0, -180)
Part13.Color = Color3.new(0.129412, 0.329412, 0.72549)
SpecialMesh14.Parent = Part13
SpecialMesh14.MeshType = Enum.MeshType.Sphere
PointLight15.Name = "Light2"
PointLight15.Parent = Part13
PointLight15.Color = Color3.new(0, 0.666667, 1)
PointLight15.Enabled = false
PointLight15.Brightness = 5
PointLight15.Color = Color3.new(0, 0.666667, 1)
BillboardGui16.Name = "Light"
BillboardGui16.Parent = Part13
BillboardGui16.Size = UDim2.new(3, 0, 3, 0)
BillboardGui16.Enabled = false
BillboardGui16.ExtentsOffset = Vector3.new(0, 0, 1)
ImageLabel17.Name = "Light"
ImageLabel17.Parent = BillboardGui16
ImageLabel17.Transparency = 1
ImageLabel17.Size = UDim2.new(1, 0, 1, 0)
ImageLabel17.BackgroundTransparency = 1
ImageLabel17.Image = "http://www.roblox.com/asset/?id=134532208"
Part18.Name = "RightLight"
Part18.Parent = Tool0
Part18.Material = Enum.Material.SmoothPlastic
Part18.BrickColor = BrickColor.new("Deep blue")
Part18.Reflectance = 0.10000000149012
Part18.Transparency = 1
Part18.Rotation = Vector3.new(0, 0, -180)
Part18.CanCollide = false
Part18.FormFactor = Enum.FormFactor.Custom
Part18.Size = Vector3.new(0.400000006, 0.200000003, 0.200000003)
Part18.CFrame = CFrame.new(83.6999817, 5.62722111, 68.2604904, -1, 1.25603208e-07, -1.30385143e-08, -1.43017303e-07, -1, -2.98068983e-08, 5.58794211e-09, -1.1389605e-07, 1)
Part18.BottomSurface = Enum.SurfaceType.Smooth
Part18.TopSurface = Enum.SurfaceType.Smooth
Part18.Color = Color3.new(0.129412, 0.329412, 0.72549)
Part18.Position = Vector3.new(83.6999817, 5.62722111, 68.2604904)
Part18.Orientation = Vector3.new(0, 0, -180)
Part18.Color = Color3.new(0.129412, 0.329412, 0.72549)
SpecialMesh19.Parent = Part18
SpecialMesh19.MeshType = Enum.MeshType.Sphere
PointLight20.Name = "Light2"
PointLight20.Parent = Part18
PointLight20.Color = Color3.new(0, 0.666667, 1)
PointLight20.Enabled = false
PointLight20.Brightness = 5
PointLight20.Color = Color3.new(0, 0.666667, 1)
BillboardGui21.Name = "Light"
BillboardGui21.Parent = Part18
BillboardGui21.Size = UDim2.new(3, 0, 3, 0)
BillboardGui21.Enabled = false
BillboardGui21.ExtentsOffset = Vector3.new(0, 0, 1)
ImageLabel22.Name = "Light"
ImageLabel22.Parent = BillboardGui21
ImageLabel22.Transparency = 1
ImageLabel22.Size = UDim2.new(1, 0, 1, 0)
ImageLabel22.BackgroundTransparency = 1
ImageLabel22.Image = "http://www.roblox.com/asset/?id=134532208"
Part23.Name = "FrontLight"
Part23.Parent = Tool0
Part23.Material = Enum.Material.SmoothPlastic
Part23.BrickColor = BrickColor.new("Deep blue")
Part23.Reflectance = 0.10000000149012
Part23.Transparency = 1
Part23.Rotation = Vector3.new(0, 0, -180)
Part23.CanCollide = false
Part23.FormFactor = Enum.FormFactor.Custom
Part23.Size = Vector3.new(0.5, 0.200000003, 0.200000003)
Part23.CFrame = CFrame.new(82.3499832, 4.52722788, 67.5604935, -1, 1.25603208e-07, -1.30385143e-08, -1.43017303e-07, -1, -2.98068983e-08, 5.58794211e-09, -1.1389605e-07, 1)
Part23.BottomSurface = Enum.SurfaceType.Smooth
Part23.TopSurface = Enum.SurfaceType.Smooth
Part23.Color = Color3.new(0.129412, 0.329412, 0.72549)
Part23.Position = Vector3.new(82.3499832, 4.52722788, 67.5604935)
Part23.Orientation = Vector3.new(0, 0, -180)
Part23.Color = Color3.new(0.129412, 0.329412, 0.72549)
SpecialMesh24.Parent = Part23
SpecialMesh24.MeshType = Enum.MeshType.Sphere
BillboardGui25.Name = "Light"
BillboardGui25.Parent = Part23
BillboardGui25.Size = UDim2.new(5, 0, 3, 0)
BillboardGui25.Enabled = false
BillboardGui25.ExtentsOffset = Vector3.new(0, 0, 1)
ImageLabel26.Name = "Light"
ImageLabel26.Parent = BillboardGui25
ImageLabel26.Transparency = 1
ImageLabel26.Size = UDim2.new(1, 0, 1, 0)
ImageLabel26.BackgroundTransparency = 1
ImageLabel26.Image = "http://www.roblox.com/asset/?id=23596922"
SurfaceLight27.Name = "Light2"
SurfaceLight27.Parent = Part23
SurfaceLight27.Range = 19.239078521729
SurfaceLight27.Angle = 57.401973724365
Script28.Parent = Part23
table.insert(cors,sandbox(Script28,function()
while true do
wait()
if script.Parent.Parent.BackLight.Light.Enabled == true then
script.Parent.Light.Enabled = true
script.Parent.Light2.Enabled = true
else
script.Parent.Light.Enabled = false
script.Parent.Light2.Enabled = false
end
end
end))
Script29.Name = "qPerfectionWeld"
Script29.Parent = Tool0
table.insert(cors,sandbox(Script29,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))
LocalScript30.Name = "continuumScript"
LocalScript30.Parent = Tool0
table.insert(cors,sandbox(LocalScript30,function()
function WaitForChild(parent,child)
return parent[child]
end
local int = WaitForChild(script.Parent,'IsReady')
local handle = WaitForChild(script.Parent,'Handle')
local BackLight = WaitForChild(script.Parent,'BackLight')
local LeftLight = WaitForChild(script.Parent,'LeftLight')
local RightLight = WaitForChild(script.Parent,'RightLight')
local EngineSound = WaitForChild(handle,'Running')
local gui2 = nil
local radio = false
local siren = false
local siren2 = false
local HoldAni = WaitForChild(script.Parent,'holdAni')
local lights = false
local left=false
local right=false
local up=false
local down=false
local mouse
local Character
local key_down_connect
local key_up_connect
local thrustForce
local thrustMagnitude
local thrustDirection
local RotationForce
local TurnGyro
local HoldAniTrack
local torsoWeld
local SmokePart = Instance.new('Part')
SmokePart.Transparency = 1
SmokePart.Size = Vector3.new(0,0,0)
local ExhaustSmoke = Instance.new('Smoke')
ExhaustSmoke.Parent = SmokePart
ExhaustSmoke.Size = .1
ExhaustSmoke.RiseVelocity = .01
ExhaustSmoke.Color = Color3.new(.5,.5,.5)
ExhaustSmoke.Enabled = false
local acceleration = 30
local deceleration = 25
local turnAlpha = .25
local alphaDampening = .15
local Equipped = false
local LastPosition = nil
local ActualVelocity = Vector3.new(0,0,0)
local FakeHandle = nil
local FrontWheel = Instance.new('Part')
FrontWheel.FormFactor = 'Custom'
FrontWheel.CanCollide = false
FrontWheel.Size = Vector3.new(0,0,0)
local WheelMesh = Instance.new('SpecialMesh')
WheelMesh.MeshId = "http://www.roblox.com/asset/?id=438123816"
WheelMesh.TextureId = "http://www.roblox.com/asset/?id=438106307"
WheelMesh.Scale = Vector3.new(0.007,0.007,0.007)
local Light = FrontWheel:Clone()
local LightWeld = nil
local FrontMotor = nil
local BackWheel = FrontWheel:Clone()
local BackMotor = nil
local CurrentSpeed=0
local turnSpeed=0
local turnSpeedAim=10
function ThrustUpdater()
coroutine.resume(coroutine.create(function()
while Equipped do wait()
if lights then
BackLight.Light.Enabled = true
LeftLight.Light.Enabled = true
BackLight.Light2.Enabled = true
LeftLight.Light2.Enabled = true
wait(0.1)
RightLight.Light.Enabled = true
LeftLight.Light.Enabled = false
RightLight.Light2.Enabled = true
LeftLight.Light2.Enabled = false
wait(0.1)
RightLight.Light.Enabled = false
BackLight.Light.Enabled = false
RightLight.Light2.Enabled = false
BackLight.Light2.Enabled = false
wait(0.1)
BackLight.Light.Enabled = false
LeftLight.Light.Enabled = false
RightLight.Light.Enabled = false
BackLight.Light2.Enabled = false
LeftLight.Light2.Enabled = false
RightLight.Light2.Enabled = false wait(0.1)
end
end
lights = false
BackLight.Material = "SmoothPlastic"
LeftLight.Material = "SmoothPlastic"
RightLight.Material = "SmoothPlastic"
BackLight.Light2.Enabled = false
LeftLight.Light2.Enabled = false
RightLight.Light2.Enabled = false
end))
if not script:findFirstChild("Selected") then
Instance.new("IntValue",script).Name = "Selected"
game.Players[script.Parent.Parent.Name].Chatted:connect(function(MSG)
if radio and game.Lighting:findFirstChild("OfficerRadioSystem") and game.Players[script.Parent.Parent.Name]:findFirstChild("PlayerGui") then
if game.Players[script.Parent.Parent.Name].PlayerGui:findFirstChild("OfficerRadio") and Equipped then
local Channel = game.Lighting["OfficerRadioSystem"]
Channel.Line1.Value = Channel.Line2.Value
Channel.Line2.Value = Channel.Line3.Value
Channel.Line3.Value = Channel.Line4.Value
Channel.Line4.Value = Channel.Line5.Value
Channel.Line5.Value = Channel.Line6.Value
Channel.Line6.Value = Channel.Line7.Value
Channel.Line7.Value = script.Parent.Parent.Name..": "..MSG
end
end
end)
end
while Equipped do
local direction = Character:FindFirstChild("Torso").CFrame.lookVector
direction = Vector3.new(direction.x,0,direction.z).unit
thrustForce.velocity = direction*(CurrentSpeed)
EngineSound.Pitch = 1+(math.abs(CurrentSpeed/50)*1)
if FrontMotor then
FrontMotor.DesiredAngle=(999999999)* (-CurrentSpeed/math.abs(CurrentSpeed))
FrontMotor.MaxVelocity = CurrentSpeed/250
if BackMotor then
BackMotor.DesiredAngle = FrontMotor.DesiredAngle
BackMotor.MaxVelocity = FrontMotor.MaxVelocity
end
end
RotationForce.angularvelocity = Vector3.new(0, turnSpeed, 0)
if math.abs(turnSpeed)>alphaDampening then
turnSpeed= turnSpeed-((alphaDampening)*(math.abs(turnSpeed)/turnSpeed))
else
turnSpeed = 0
end
local leanAmount= -turnSpeed*(math.pi/6)/10 --FIND ME
if not forwards or back then
CurrentSpeed = CurrentSpeed*.99
end
local xzAngle = math.atan2(Character.Torso.CFrame.lookVector.z,0, Character.Torso.CFrame.lookVector.x)
TurnGyro.cframe=CFrame.Angles(leanAmount*direction.x,0,leanAmount*direction.z)
ExhaustSmoke.Opacity = (math.min(math.abs(CurrentSpeed),10)/10)*.5
if LastPosition then
local npos = Vector3.new(Character.Torso.CFrame.p.x,0,Character.Torso.CFrame.p.z)
--(npos-LastPosition).magnitude
local myspeed =Vector3.new(FakeHandle.Velocity.X,0,FakeHandle.Velocity.Z).magnitude
local velocityDifference = math.abs((myspeed - (thrustForce.velocity.magnitude)))
if myspeed>3 and thrustForce.velocity.magnitude>3 and velocityDifference> .7*thrustForce.velocity.magnitude then
CurrentSpeed=CurrentSpeed*.9
end
end
LastPosition = Vector3.new(Character.Torso.CFrame.p.x,0,Character.Torso.CFrame.p.z)
wait(1/60)
end
end
function onEquipped(nmouse)
Spawn(function()
if Equipped then
return
end
--
local gui = WaitForChild(game.Players[script.Parent.Parent.Name],"PlayerGui")
gui2 = script.BikeGui:Clone()
gui2.Parent = gui
Character=script.Parent.Parent
local myTorso = WaitForChild(Character,'Torso')
if not FakeHandle then
FakeHandle = handle:Clone()
FakeHandle.Name = 'FakeHandle'
FakeHandle.Size = Vector3.new(1, 7, 6)
FakeHandle:WaitForChild('Mesh').MeshId = "http://www.roblox.com/asset/?id=575950615"
end
FakeHandle.Parent = script.Parent
FakeHandle.CFrame = myTorso.CFrame
handle.Transparency = 1
Spawn(function()
FrontWheel.Parent = FakeHandle
FrontMotor = Instance.new('Motor6D')
FrontMotor.C0 = CFrame.new(0, -2.4, -3.02) * CFrame.Angles(0, (math.pi / 2), 0)
FrontMotor.C1 = CFrame.new() * CFrame.Angles(0, -(math.pi / 2), 0)
FrontMotor.Part0 = FakeHandle
FrontMotor.Part1 = FrontWheel
FrontMotor.Parent =FakeHandle
WheelMesh:Clone().Parent = FrontWheel
BackWheel.Parent = FakeHandle
BackMotor = Instance.new('Motor6D')
BackMotor.C0 = CFrame.new(0, -2.4, 2.9) * CFrame.Angles(0, (math.pi / 2), 0)
BackMotor.C1 = CFrame.new() * CFrame.Angles(0, -(math.pi / 2), 0)
BackMotor.Part0 = FakeHandle
BackMotor.Part1 = BackWheel
BackMotor.Parent =FakeHandle
WheelMesh:Clone().Parent = BackWheel
Light.Parent = FakeHandle
LightWeld = Instance.new('Weld')
LightWeld.C0 = CFrame.new(0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
LightWeld.C1 = CFrame.new(-0.140708923, -0.749996185, -0.9377985, -1.63912773e-007, -1.27675008e-008, -1.00000024, -2.05633661e-008, 0.99999994, 3.65663944e-009, 0.999999881, 5.65337004e-008, -7.4505806e-008)
LightWeld.Part0 = FakeHandle
LightWeld.Part1 = Light
LightWeld.Parent = FakeHandle
local tlight = Instance.new('SpotLight')
tlight.Brightness = 1
tlight.Angle=45
tlight.Color = Color3.new(255/255,252/255,153/255)
tlight.Parent = Light
tlight.Range = 40
end)
CurrentSpeed=0
turnSpeed=0
mouse=nmouse
Equipped = true
handle.CFrame = myTorso.CFrame
WaitForChild(Character,'Humanoid').PlatformStand = true
if RotationForce then RotationForce:Destroy() end
RotationForce = Instance.new('BodyAngularVelocity')
RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
RotationForce.angularvelocity = Vector3.new(0, 0, 0)
RotationForce.Parent = myTorso
if thrustForce then thrustForce:Destroy() end
thrustForce = Instance.new('BodyVelocity')
thrustForce.maxForce = Vector3.new(math.huge,0,math.huge)
thrustForce.velocity = Vector3.new(0,0,0)
thrustForce.P = 100
thrustForce.Parent = FakeHandle--myTorso
if TurnGyro then TurnGyro:Destroy() end
TurnGyro = Instance.new('BodyGyro')
TurnGyro.maxTorque = Vector3.new(5000,0,5000)
TurnGyro.P = 300
TurnGyro.D=100
TurnGyro.Parent = myTorso
Spawn(ThrustUpdater)
if HoldAniTrack then HoldAniTrack:Stop() end
HoldAniTrack = WaitForChild(Character,'Humanoid'):LoadAnimation(HoldAni)
HoldAniTrack:Play()
Spawn(function()
myTorso.Anchored = true
myTorso.CFrame = myTorso.CFrame+Vector3.new(0,3,0)
if torsoWeld then torsoWeld:Destroy() end
torsoWeld=Instance.new('Weld')
torsoWeld.C0 = CFrame.Angles(0,0,0) + Vector3.new(0, -0.6, -0.7) --FIND ME -1.6
torsoWeld.Part0 = myTorso
torsoWeld.Part1 = FakeHandle
torsoWeld.Parent = FakeHandle
FakeHandle.CanCollide = true
wait(.1)
FakeHandle.CanCollide = true
myTorso.Anchored = false
myTorso.CFrame = myTorso.CFrame+Vector3.new(0,3,0)
end)
if key_down_connect then
key_down_connect:disconnect()
key_up_connect:disconnect()
end
key_down_connect=mouse.KeyDown:connect(keyDownFunc)
key_up_connect=mouse.KeyUp:connect(keyUpFunc)
SmokePart.Parent = FakeHandle
local tweld=Instance.new('Weld')
tweld.C0 = CFrame.new(0.600000024, 1.10000014, -2.20000005, 1, 0, 0, 0, 1, 0, 0, 0, 1)
tweld.Part0 = SmokePart
tweld.Part1 = FakeHandle
tweld.Parent = SmokePart
EngineSound:Play()
Character.Humanoid.WalkSpeed = 0
--end
end)
end
function onUnequipped()
Equipped = false
if gui2 then
gui2:Remove() gui2 = nil
end
if SmokePart then
SmokePart.Parent = nil
end
if FakeHandle then
FakeHandle:Remove()
FakeHandle = nil
end
handle.Transparency = 0
--handle.Size = Vector3.new(0.2, 0.2, 0.2)
forwards = false
left = false
back = false
right = false
if RotationForce then
RotationForce:Destroy()
RotationForce=nil
end
if thrustForce then
thrustForce:Destroy()
thrustForce=nil
end
if TurnGyro then
TurnGyro:Destroy()
TurnGyro=nil
end
if HoldAniTrack then
HoldAniTrack:Stop()
end
if torsoWeld then
torsoWeld:Destroy()
torsoWeld=nil
end
if key_down_connect then
key_down_connect:disconnect()
key_down_connect=nil
end
if key_up_connect then
key_up_connect:disconnect()
key_up_connect=nil
end
if EngineSound then
EngineSound:Stop()
end
if Character and Character:FindFirstChild('Humanoid') then
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.PlatformStand = false
end
end
function keyUpFunc(key)
if key == nil then return end
local key = key:lower()
if key == "w" then
forwards = false
elseif key == "a" then
left = false
elseif key == "s" then
back = false
elseif key == "d" then
right = false
end
end
local LastSpace = tick()
function keyDownFunc(key)
if key == nil then return end
if inIntro then return end
local key = key:lower()
if key == "w" then
forwards = true
while forwards do
CurrentSpeed = math.min(120,CurrentSpeed+(acceleration*(1/30)))
wait(1/30)
end
elseif key == "a" then
left = true
while left do
turnSpeed= math.min(5,turnSpeed+(turnAlpha))
wait(1/30)
end
elseif key == "s" then
back = true
while back do
if CurrentSpeed>0 then
CurrentSpeed = math.max(-20,CurrentSpeed-(deceleration*2.8*(1/30)))
else
CurrentSpeed = math.max(-20,CurrentSpeed-(deceleration*(1/30)))
end
wait(1/30)
end
elseif key == "d" then
right = true
while right do
turnSpeed= math.max(-5,turnSpeed-(turnAlpha))
wait(1/30)
end
elseif key == ' ' then
if tick()-LastSpace>1.9 then
LastSpace = tick()
local bforce = Instance.new('BodyForce')
bforce.force = Vector3.new(0,25000,0)
bforce.Parent = FakeHandle
wait(.1)
bforce:Destroy()
end
elseif key == "r" then
lights = not lights
elseif key == "t" then
if siren then
siren = false
else
siren2 = false
siren = true
handle.Siren:Play()
while siren and Equipped do
wait()
end
handle.Siren:Stop()
end
elseif key == "y" then
if siren2 then
siren2 = false
else
siren = false
siren2 = true
handle.Siren1:Play()
while siren2 and Equipped do
wait()
end
handle.Siren1:Stop()
end
end
end
script.Parent.Unequipped:connect(onUnequipped)
script.Parent.Equipped:connect(onEquipped)
end))
ScreenGui31.Name = "BikeGui"
ScreenGui31.Parent = LocalScript30
TextLabel32.Name = "Creds"
TextLabel32.Parent = ScreenGui31
TextLabel32.Transparency = 1
TextLabel32.Size = UDim2.new(0.150000006, 0, 0.0500000007, 0)
TextLabel32.Text = "Bike by clonetrooper517"
TextLabel32.Position = UDim2.new(0.850000024, 0, 0.949999988, 0)
TextLabel32.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel32.BackgroundTransparency = 1
TextLabel32.BorderColor3 = Color3.new(0.509804, 0.796079, 1)
TextLabel32.BorderSizePixel = 0
TextLabel32.Font = Enum.Font.ArialBold
TextLabel32.FontSize = Enum.FontSize.Size18
TextLabel32.TextColor3 = Color3.new(1, 1, 1)
TextLabel32.TextStrokeColor3 = Color3.new(1, 1, 1)
TextLabel32.TextTransparency = 0.25
TextLabel32.TextWrapped = true
TextLabel33.Name = "Creds"
TextLabel33.Parent = ScreenGui31
TextLabel33.Transparency = 1
TextLabel33.Size = UDim2.new(0.150000006, 0, 0.0500000007, 0)
TextLabel33.Text = "Keys : R - Lights || T - Wail || Y - Yelp "
TextLabel33.Position = UDim2.new(0.850000024, 0, 0.930000007, 0)
TextLabel33.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel33.BackgroundTransparency = 1
TextLabel33.BorderColor3 = Color3.new(0.509804, 0.796079, 1)
TextLabel33.BorderSizePixel = 0
TextLabel33.Font = Enum.Font.ArialBold
TextLabel33.FontSize = Enum.FontSize.Size18
TextLabel33.TextColor3 = Color3.new(1, 1, 1)
TextLabel33.TextStrokeColor3 = Color3.new(1, 1, 1)
TextLabel33.TextTransparency = 0.25
TextLabel33.TextWrapped = true
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
--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")
Part1a = Instance.new("Part")
SpecialMesh2 = Instance.new("SpecialMesh")
Sound3 = Instance.new("Sound")
Sound4 = Instance.new("Sound")
Sound5 = Instance.new("Sound")
Sound6 = Instance.new("Sound")
Sound7 = Instance.new("Sound")
Fire8 = Instance.new("Fire")
SpotLight9 = Instance.new("SpotLight")
LocalScript10 = Instance.new("LocalScript")
LocalScript11 = Instance.new("LocalScript")
ScreenGui12 = Instance.new("ScreenGui")
Frame13 = Instance.new("Frame")
Frame14 = Instance.new("Frame")
Frame15 = Instance.new("Frame")
Frame16 = Instance.new("Frame")
Frame17 = Instance.new("Frame")
ImageLabel18 = Instance.new("ImageLabel")
TextLabel19 = Instance.new("TextLabel")
Frame20 = Instance.new("Frame")
TextLabel21 = Instance.new("TextLabel")
TextLabel22 = Instance.new("TextLabel")
TextLabel23 = Instance.new("TextLabel")
Animation24 = Instance.new("Animation")
Animation25 = Instance.new("Animation")
Animation26 = Instance.new("Animation")
Tool0.Name = "Shotgun"
Tool0.Parent = mas
Tool0.GripForward = Vector3.new(-0.502650201, 0.864488423, 0.00155316177)
Tool0.GripPos = Vector3.new(0.382296324, -0.310117602, -0.246956125)
Tool0.GripRight = Vector3.new(0.864489377, 0.502651095, -0.000195711225)
Tool0.GripUp = Vector3.new(0.000949888548, -0.00124431751, 0.999998748)
Part1a.Name = "Handle"
Part1a.Parent = Tool0
Part1a.BrickColor = BrickColor.new("Dark stone grey")
Part1a.Rotation = Vector3.new(-90, 0, 0)
Part1a.CanCollide = false
Part1a.FormFactor = Enum.FormFactor.Custom
Part1a.Size = Vector3.new(0.200000003, 2.39999986, 0.600000024)
Part1a.CFrame = CFrame.new(97.9000015, 2.29999995, 1.00000072, 0.999999642, -3.04374943e-08, 8.94069387e-08, 2.83367569e-08, 3.00544468e-14, 0.999999702, 8.8771742e-08, -0.999999583, 4.95648855e-08)
Part1a.BackSurface = Enum.SurfaceType.Weld
Part1a.BottomSurface = Enum.SurfaceType.Weld
Part1a.FrontSurface = Enum.SurfaceType.Weld
Part1a.LeftSurface = Enum.SurfaceType.Weld
Part1a.RightSurface = Enum.SurfaceType.Weld
Part1a.TopSurface = Enum.SurfaceType.Weld
Part1a.Color = Color3.new(0.388235, 0.372549, 0.384314)
Part1a.Position = Vector3.new(97.9000015, 2.29999995, 1.00000072)
Part1a.Orientation = Vector3.new(-89.9599991, 61, 90)
Part1a.Color = Color3.new(0.388235, 0.372549, 0.384314)
SpecialMesh2.Parent = Part1a
SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=71947462"
SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=71947415"
SpecialMesh2.VertexColor = Vector3.new(2, 2, 2)
SpecialMesh2.MeshType = Enum.MeshType.FileMesh
Sound3.Name = "Empty"
Sound3.Parent = Part1a
Sound3.SoundId = "rbxassetid://240785604"
Sound3.Volume = 1
Sound4.Name = "FireSound"
Sound4.Parent = Part1a
Sound4.SoundId = "rbxassetid://330706798"
Sound4.Volume = 1
Sound5.Name = "InsertSound"
Sound5.Parent = Part1a
Sound5.SoundId = "rbxassetid://255061162"
Sound5.Volume = 1
Sound6.Name = "PumpSound"
Sound6.Parent = Part1a
Sound6.SoundId = "rbxassetid://131072992"
Sound6.Volume = 0.75
Sound7.Name = "Reload"
Sound7.Parent = Part1a
Sound7.SoundId = "rbxassetid://198915489"
Sound7.Volume = 1
Fire8.Parent = Part1a
Fire8.Size = 2
Fire8.Color = Color3.new(0.145098, 0.145098, 0.164706)
Fire8.Enabled = false
Fire8.Heat = 0
Fire8.SecondaryColor = Color3.new(0, 0, 0)
Fire8.Color = Color3.new(0.145098, 0.145098, 0.164706)
SpotLight9.Name = "Light"
SpotLight9.Parent = Part1a
SpotLight9.Color = Color3.new(1, 1, 0.498039)
SpotLight9.Enabled = false
SpotLight9.Brightness = 50
SpotLight9.Range = 18
SpotLight9.Angle = 120
SpotLight9.Face = Enum.NormalId.Top
SpotLight9.Color = Color3.new(1, 1, 0.498039)
LocalScript10.Name = "CameraMoveDev"
LocalScript10.Parent = Tool0
table.insert(cors,sandbox(LocalScript10,function()
local RunService = game:GetService('RunService')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
repeat wait() until player.Character
repeat wait() until player.Character:FindFirstChild("Humanoid")
repeat wait() until player.Character:FindFirstChild("Torso")
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
torso = character.Torso
keyhold = false
--player.CameraMinZoomDistance = 0.5
lighting = true
haslight = false
mouse.TargetFilter = nil
--humanoid.JumpPower = 0
maxcount = 100
runcount = maxcount
function populateparts(mdl)
if mdl:IsA("BasePart") then
table.insert(parts,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populateparts(mdl2)
end
end
function weldBetween(a, b)
--Make a new Weld and Parent it to a.
weld = Instance.new("ManualWeld", a)
--Get the CFrame of b relative to a.
weld.C0 = a.CFrame:inverse() * b.CFrame
--Set the Part0 and Part1 properties respectively
weld.Part0 = a
weld.Part1 = b
--Return the reference to the weld so that you can change it later.
return weld
end
humanoid.Died:connect(function()
if armgroup then
armgroup:Destroy()
if cl then
cl:Destroy()
end
if cl2 then
cl2:Destroy()
end
end
end)
LocalObjects = {}
function SetLocalTransparency(Table)
for i, v in pairs(LocalObjects) do
if v.Object == Table.Object then
Table.Object.LocalTransparencyModifier = Table.OriginalTransparency
table.remove(LocalObjects, i)
end
end
if not Table.Transparency then
return
end
Table.OriginalTransparency = Table.Object.LocalTransparencyModifier
table.insert(LocalObjects, Table)
if ModifyTransparency then
ModifyTransparency:disconnect()
end
ModifyTransparency = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
local function SetupJoints()
if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
return -- TODO: Make tracking compatible with R15
end
torso = character:FindFirstChild("Torso")
Neck = torso.Neck
OldNeckC0 = Neck.C0
OldNeckC1 = Neck.C1
Shoulder = torso['Right Shoulder']
Shoulder2 = torso['Left Shoulder']
OldShoulderC0 = Shoulder.C0
OldShoulderC1 = Shoulder.C1
OldShoulder2C0 = Shoulder2.C0
OldShoulder2C1 = Shoulder2.C1
end
local function visual()
if Tool then
if Tool:FindFirstChild("GetKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.5
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetKill:Destroy()
end
if Tool:FindFirstChild("GetHeadKill") and not game.Workspace.CurrentCamera:FindFirstChild("KillColor") then
Color = Instance.new("ColorCorrectionEffect")
Color.Name = "KillColor"
Color.Saturation = -0.75
Color.TintColor = Color3.new(1, 0.9, 0.9)
Color.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Color, 0.22)
Blur = Instance.new("BlurEffect")
Blur.Name = "KillBlur"
Blur.Size = 8
Blur.Parent = game.Workspace.CurrentCamera
game.Debris:AddItem(Blur, 0.22)
Tool.GetHeadKill:Destroy()
end
end
--player.CameraMode = Enum.CameraMode.LockFirstPerson
end
SetupJoints()
game:GetService("RunService").RenderStepped:connect(function()
if character and humanoid.Health > 0 and script.Parent.Parent == character then
if character:FindFirstChildOfClass("Tool") and character:FindFirstChildOfClass("Tool") == script.Parent then
Tool = character:FindFirstChildOfClass("Tool")
visual()
else
Tool = nil
end
if Tool and Tool.Enabled == true then
character.Humanoid.AutoRotate = false
mouse.TargetFilter = game.Workspace
--if (game.Workspace.CurrentCamera.CoordinateFrame.p - game.Workspace.CurrentCamera.Focus.p).magnitude < 1 then
--game.Workspace.CurrentCamera.CameraSubject = character.Head
game.Workspace.CurrentCamera.Focus = character.Head.CFrame
--end
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
local toMouse = (mouse.Hit.p - character.Head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
character.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2,0)
character.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/-2,0)
if character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
character['Torso'].CFrame = CFrame.new(character['Torso'].Position, character['Torso'].Position + (Vector3.new(
mouse.Hit.x, character['Torso'].Position.Y, mouse.Hit.z)-character['Torso'].Position).unit)
end
else
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end
end
end)
script.Parent.Unequipped:connect(function()
if armgroup then
armgroup:Destroy()
armgroup = nil
end
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
character['Torso'].Neck.C0 = OldNeckC0
character['Torso'].Neck.C1 = OldNeckC1
character['Torso']['Right Shoulder'].C0 = OldShoulderC0
character['Torso']['Right Shoulder'].C1 = OldShoulderC1
character['Torso']['Left Shoulder'].C0 = OldShoulder2C0
character['Torso']['Left Shoulder'].C1 = OldShoulder2C1
character.Humanoid.AutoRotate = true
mouse.TargetFilter = nil
game.Workspace.CurrentCamera.CameraSubject = character.Humanoid
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
SetLocalTransparency({Object = v, Transparency = nil, AutoUpdate = true})
end
if v:IsA("Accessory") then
SetLocalTransparency({Object = v.Handle, Transparency = nil, AutoUpdate = true})
end
end
end
end)
end))
LocalScript11.Name = "AssaultRifleScript"
LocalScript11.Parent = Tool0
table.insert(cors,sandbox(LocalScript11,function()
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
----- MAGIC NUMBERS ABOUT THE TOOL -----
local Auto = false
local ShotgunShots = 12
-- How much damage a bullet does
local Damage = 22
local HeadMultiplier = 1.65
-- How many times per second the gun can fire
local FireRate = 0.35
-- The maximum distance the can can shoot, this value should never go above 1000
local Range = 400
-- In radians the minimum accuracy penalty
local MinSpread = 0.075
-- In radian the maximum accuracy penalty
local MaxSpread = 0.075
-- Number of bullets in a clip
local ClipSize = 8
-- DefaultValue for spare ammo
local SpareAmmo = 160
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect
local AimInaccuracyStepAmount = 0.0125
-- Time it takes to reload weapon
local ReloadTime = 3
----------------------------------------
-- Colors
local FriendlyReticleColor = Color3.new(0, 1, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 1, 1)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local LeftButtonDown
local Reloading = false
local IsShooting = false
-- Player specific convenience variables
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local IconURL = Tool.TextureId -- URL to the weapon icon asset
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = Workspace.Terrain.GetCell
function RayIgnoreCheck(hit, pos)
if hit then
if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
return true
elseif hit:IsA('Terrain') and pos then
local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
if cellPos then
local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
if cellMat and cellMat == Enum.CellMaterial.Water then
return true
end
end
end
end
return false
end
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateFlash()
Handle.Light.Enabled = true
delay(0.01, function()
Handle.Light.Enabled = false
end)
if FlashHolder then
if not flash then
flash = Instance.new('Fire', FlashHolder)
flash.Color = Color3.new(1, 140 / 255, 0)
flash.SecondaryColor = Color3.new(1, 0, 0)
flash.Heat = 0
flash.Size = 0.3
delay(0.02, function()
flash.Enabled = false
end)
else
flash.Enabled = true
delay(0.02, function()
flash.Enabled = false
end)
end
else
FlashHolder = Instance.new("Part", Tool)
FlashHolder.Transparency = 1
FlashHolder.CanCollide= false
FlashHolder.Size = Vector3.new(1, 1, 1)
FlashHolder.Position = Tool.Handle.Position
local Weld = Instance.new("ManualWeld")
Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Weld.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Weld.Part0 = FlashHolder
Weld.Part1 = Tool.Handle
Weld.Parent = FlashHolder
end
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.2, 0.2, 0.2)
bullet.BrickColor = BrickColor.new("Really black")
bullet.Material = "Neon"
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
--[[local fire = Instance.new("Fire", bullet)
fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.Size = 1
fire.Heat = 0
DebrisService:AddItem(fire, 0.1)]]--
return bullet
end
local function weldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld;
end
local function Reload()
if not Reloading and stance == false then
Reloading = true
if AmmoInClip ~= 0 then
full = true
else
full = false
end
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize then
if PumpTrack then
PumpTrack:Stop()
end
for i = 1,ClipSize-AmmoInClip do
if PumpTrack then
PumpTrack:Play()
end
if Handle:FindFirstChild('PumpSound') then
Handle.InsertSound:Play()
end
AmmoInClip = AmmoInClip + 1
UpdateAmmo(AmmoInClip+1)
wait(0.5)
end
if full == false then
if PumpTrack then
PumpTrack:Play()
end
if Handle:FindFirstChild('PumpSound') then
Handle.PumpSound:Play()
end
wait(0.5)
end
-- Only use as much ammo as you have
local ammoToUse = ClipSize - AmmoInClip
AmmoInClip = AmmoInClip + ammoToUse
UpdateAmmo(AmmoInClip)
end
Reloading = false
end
end
function OnFire()
if IsShooting or stance == true then return end
if MyHumanoid and MyHumanoid.Health > 0 then
IsShooting = true
if AmmoInClip == 0 then
Handle.Empty:Play()
end
while LeftButtonDown and AmmoInClip > 0 and not Reloading and MyHumanoid and MyHumanoid.Health > 0 and stance == false do
if Auto == false then
LeftButtonDown = false
end
RecoilTrack:Play()
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
for i = 1, ShotgunShots do
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
TagHumanoid(hitHumanoid, MyPlayer)
if hitObject.Name == "Head" then
hitHumanoid:TakeDamage(Damage * HeadMultiplier)
else
hitHumanoid:TakeDamage(Damage)
end
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
wait(0.15)
if RecoilTrack then
RecoilTrack:Stop()
end
wait(0.15)
if AmmoInClip > 0 then
if PumpTrack then
PumpTrack:Play()
end
if Handle:FindFirstChild('PumpSound') then
Handle.PumpSound:Play()
end
wait(.1)
local CasingBase = Instance.new('Part')
CasingBase.FormFactor = Enum.FormFactor.Custom
CasingBase.Elasticity = 0
CasingBase.Size = Vector3.new(.3,.3,.5)
local CasingMesh = Instance.new('SpecialMesh')
CasingMesh.MeshId = 'http://www.roblox.com/asset/?id=94248124'
CasingMesh.TextureId = 'http://www.roblox.com/asset/?id=94219470'
--CasingMesh.Scale = Vector3.new(.75,.75,.75)
CasingMesh.Parent = CasingBase
local casing = CasingBase
casing.Position = Tool.Handle.Position + Vector3.new(0,0,0)
casing.Velocity = (Vector3.new((math.random()-.5),(.5+math.random()),(math.random()-.5)) - 1*(Tool.Handle.CFrame * CFrame.Angles(0,math.pi/4,0)).lookVector)*20
DebrisService:AddItem(casing, 2.5)
casing.Parent = game.Workspace
end
wait(FireRate)
end
IsShooting = false
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function safety()
if stance == false and not Reloading then
stance = true
Tool.Enabled = false
passive:Play()
else
stance = false
Tool.Enabled = true
if passive then
passive:Stop()
end
end
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
if string.lower(key) == 'q' then
safety()
end
end
function OnEquipped(mouse)
RecoilAnim = WaitForChild(Tool, 'FireAni')
PumpAnim = WaitForChild(Tool, 'Reload')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if PumpAnim then
PumpTrack = MyHumanoid:LoadAnimation(PumpAnim)
end
idle = MyHumanoid:LoadAnimation(Tool.idle)
idle:Play()
gunidleanim = Instance.new("Animation")
gunidleanim.AnimationId = "http://www.roblox.com/asset/?id=168086975"
passive = MyHumanoid:LoadAnimation(gunidleanim)
stance = false
Tool.Enabled = true
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=2966012"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
-- Unequip logic here
function OnUnequipped()
if idle then
idle:Stop()
end
if passive then
passive:Stop()
end
LeftButtonDown = false
Reloading = false
MyCharacter = nil
MyHumanoid = nil
MyTorso = nil
MyPlayer = nil
MyMouse = nil
if OnFireConnection then
OnFireConnection:disconnect()
end
if OnReloadConnection then
OnReloadConnection:disconnect()
end
if FlashHolder then
FlashHolder = nil
end
if WeaponGui then
WeaponGui.Parent = nil
WeaponGui = nil
end
if RecoilTrack then
RecoilTrack:Stop()
end
if PumpTrack then
PumpTrack:Stop()
end
end
local function SetReticleColor(color)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
if line:IsA('Frame') then
line.BorderColor3 = color
end
end
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
while true do
wait(0.033)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
SetReticleColor(NeutralReticleColor)
local target = MyMouse.Target
if target and target.Parent then
local player = PlayersService:GetPlayerFromCharacter(target.Parent)
if player then
if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
SetReticleColor(EnemyReticleColor)
else
SetReticleColor(FriendlyReticleColor)
end
end
end
end
if Spread and not IsShooting then
local currTime = time()
if currTime - LastSpreadUpdate > FireRate * 2 then
LastSpreadUpdate = currTime
Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
UpdateCrosshair(Spread, MyMouse)
end
end
end
end))
ScreenGui12.Name = "WeaponHud"
ScreenGui12.Parent = Tool0
Frame13.Name = "Crosshair"
Frame13.Parent = ScreenGui12
Frame13.Transparency = 1
Frame13.Size = UDim2.new(0, 150, 0, 150)
Frame13.Position = UDim2.new(0, 500, 0, 500)
Frame13.Visible = false
Frame13.BackgroundColor3 = Color3.new(0, 1, 0)
Frame13.BackgroundTransparency = 1
Frame13.BorderSizePixel = 0
Frame14.Name = "TopFrame"
Frame14.Parent = Frame13
Frame14.Size = UDim2.new(0, 2, 0, 14)
Frame14.Position = UDim2.new(0, -1, -0.5, -7)
Frame14.BackgroundColor3 = Color3.new(0, 0, 0)
Frame14.BorderColor3 = Color3.new(0, 1, 0)
Frame15.Name = "BottomFrame"
Frame15.Parent = Frame13
Frame15.Size = UDim2.new(0, 2, 0, 14)
Frame15.Position = UDim2.new(0, -1, 0.5, -7)
Frame15.BackgroundColor3 = Color3.new(0, 0, 0)
Frame15.BorderColor3 = Color3.new(0, 1, 0)
Frame16.Name = "RightFrame"
Frame16.Parent = Frame13
Frame16.Size = UDim2.new(0, 14, 0, 2)
Frame16.Position = UDim2.new(0.5, -7, 0, -1)
Frame16.BackgroundColor3 = Color3.new(0, 0, 0)
Frame16.BorderColor3 = Color3.new(0, 1, 0)
Frame17.Name = "LeftFrame"
Frame17.Parent = Frame13
Frame17.Size = UDim2.new(0, 14, 0, 2)
Frame17.Position = UDim2.new(-0.5, -7, 0, -1)
Frame17.BackgroundColor3 = Color3.new(0, 0, 0)
Frame17.BorderColor3 = Color3.new(0, 1, 0)
ImageLabel18.Name = "TargetHitImage"
ImageLabel18.Parent = Frame13
ImageLabel18.Transparency = 1
ImageLabel18.Size = UDim2.new(0, 50, 0, 50)
ImageLabel18.Position = UDim2.new(0, -25, 0, -25)
ImageLabel18.Visible = false
ImageLabel18.BackgroundTransparency = 1
ImageLabel18.BorderSizePixel = 0
ImageLabel18.Image = "http://www.roblox.com/asset/?id=69368028"
TextLabel19.Name = "ReloadingLabel"
TextLabel19.Parent = Frame13
TextLabel19.Transparency = 1
TextLabel19.Text = "Reloading"
TextLabel19.Position = UDim2.new(0, 20, 0, -20)
TextLabel19.Visible = false
TextLabel19.BackgroundTransparency = 1
TextLabel19.BorderSizePixel = 0
TextLabel19.Font = Enum.Font.ArialBold
TextLabel19.FontSize = Enum.FontSize.Size18
TextLabel19.TextColor3 = Color3.new(0, 0, 0)
TextLabel19.TextStrokeColor3 = Color3.new(0, 1, 0)
TextLabel19.TextStrokeTransparency = 0
TextLabel19.TextTransparency = 1
TextLabel19.TextXAlignment = Enum.TextXAlignment.Left
TextLabel19.TextYAlignment = Enum.TextYAlignment.Bottom
Frame20.Name = "AmmoHud"
Frame20.Parent = ScreenGui12
Frame20.Transparency = 1
Frame20.Size = UDim2.new(0, 200, 0, 50)
Frame20.Position = UDim2.new(1, -265, 1, -60)
Frame20.BackgroundTransparency = 1
Frame20.BorderSizePixel = 0
TextLabel21.Name = "ForwardSlash"
TextLabel21.Parent = Frame20
TextLabel21.Transparency = 0
TextLabel21.Text = "/"
TextLabel21.Position = UDim2.new(0.5, 0, 0.5, 0)
TextLabel21.BackgroundTransparency = 1
TextLabel21.BorderSizePixel = 0
TextLabel21.Font = Enum.Font.Arial
TextLabel21.FontSize = Enum.FontSize.Size48
TextLabel21.TextColor3 = Color3.new(1, 1, 1)
TextLabel22.Name = "ClipAmmo"
TextLabel22.Parent = Frame20
TextLabel22.Transparency = 0
TextLabel22.Text = "54"
TextLabel22.Position = UDim2.new(0.449999988, 0, 0.5, 0)
TextLabel22.BackgroundTransparency = 1
TextLabel22.BorderSizePixel = 0
TextLabel22.Font = Enum.Font.Arial
TextLabel22.FontSize = Enum.FontSize.Size48
TextLabel22.TextColor3 = Color3.new(1, 1, 1)
TextLabel22.TextXAlignment = Enum.TextXAlignment.Right
TextLabel23.Name = "TotalAmmo"
TextLabel23.Parent = Frame20
TextLabel23.Transparency = 0
TextLabel23.Text = "180"
TextLabel23.Position = UDim2.new(0.550000012, 0, 0.5, 0)
TextLabel23.BackgroundTransparency = 1
TextLabel23.BorderSizePixel = 0
TextLabel23.Font = Enum.Font.Arial
TextLabel23.FontSize = Enum.FontSize.Size48
TextLabel23.TextColor3 = Color3.new(1, 1, 1)
TextLabel23.TextXAlignment = Enum.TextXAlignment.Left
Animation24.Name = "FireAni"
Animation24.Parent = Tool0
Animation24.AnimationId = "http://www.roblox.com/Asset?ID=95383980"
Animation25.Name = "Reload"
Animation25.Parent = Tool0
Animation25.AnimationId = "rbxassetid://94245658"
Animation26.Name = "idle"
Animation26.Parent = Tool0
Animation26.AnimationId = "rbxassetid://94242777"
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