Prompt:
--put on startercharacterscripts
--made this from a tutorial
--i'll take this as not mine cause i dont know how to script and this was from a tutorial

Response:
local humanoid = script.Parent:WaitForChild("Humanoid")

humanoid.BreakJointsOnDeath = false

humanoid.Died:Connect(function()
	for index,joint in pairs(script.Parent:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Parent = joint.Part0
			a2.Parent = joint.Part1
			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = joint.C0
			a2.CFrame = joint.C1
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint:Destroy()
		end
	end
end)


Prompt: --EDIT BELOW----------------------------------------------------------------------

Response:
settings.PianoSoundRange = 50

settings.KeyAesthetics = true

settings.SoundSource = Piano.Keys.KeyBox

settings.CameraCFrame = CFrame.new(
	(Box.CFrame * CFrame.new(0, 0, 1)).p, -- +z is towards player
	(Box.CFrame * CFrame.new(0, 0, 0)).p
)

settings.Length = 5


Prompt:
--[[
	Similar to finally, except rejections are propagated through it.
]]

Response:
function Promise.prototype:done(finallyHandler)
	assert(
		finallyHandler == nil or type(finallyHandler) == "function",
		string.format(ERROR_NON_FUNCTION, "Promise:done")
	)
	return self:_finally(debug.traceback(nil, 2), finallyHandler, true)
end
Promise.prototype.Done = Promise.prototype.done


Prompt:
--[[**
	Decodes a string from Base64.
	@param [string] Input The input string to decode.
	@returns [string] The newly decoded string.
**--]]

Response:
function Base64:Decode(Input)
	local Output = {}
	local Length = 0

	for Index = 1, #Input, 4 do
		local C1, C2, C3, C4 = string.byte(Input, Index, Index + 3)

		local I1 = Indexes[C1] - 1
		local I2 = Indexes[C2] - 1
		local I3 = (Indexes[C3] or 1) - 1
		local I4 = (Indexes[C4] or 1) - 1

		local A = bit32_lshift(I1, 2) + bit32_rshift(I2, 4)
		local B = bit32_lshift(bit32_band(I2, 15), 4) + bit32_rshift(I3, 2)
		local C = bit32_lshift(bit32_band(I3, 3), 6) + I4

		Length = Length + 1
		Output[Length] = A
		if C3 ~= 61 then Length = Length + 1 Output[Length] = B end
		if C4 ~= 61 then Length = Length + 1 Output[Length] = C end
	end

	local NewOutput = {}
	local NewLength = 0

	for Index = 1, Length, 4096 do
		NewLength = NewLength + 1
		NewOutput[NewLength] = string.char(table.unpack(Output, Index, math.min(Index + 4096 - 1, Length)))
	end

	return table.concat(NewOutput)
end

return Base64


Prompt:
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does

Response: local Damage = 50


Prompt: --[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]

Response:
--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local JaneTheKiller=AdvancedRespawnScript.Parent;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKiller:FindFirstChild("Thumbnail")then
JaneTheKiller:FindFirstChild("Thumbnail"):Destroy();
end;
local GameDerbis=Game:GetService("Debris");
local JaneTheKillerHumanoid;
for _,Child in pairs(JaneTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JaneTheKillerHumanoid=Child;
end;
end;
local Respawndant=JaneTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JaneTheKiller and JaneTheKillerHumanoid and JaneTheKillerHumanoid:FindFirstChild("Status")and not JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JaneTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(Game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JaneTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JaneTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JaneTheKiller:FindFirstChild("SpawnForceField")then
JaneTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JaneTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
Wait(5);
Respawndant.Parent=JaneTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JaneTheKiller:remove();
end;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKillerHumanoid then
JaneTheKillerHumanoid.Died:connect(Respawn);
end;


Prompt: -- Create component

Response:
local ColorPicker = Roact.PureComponent:extend(script.Name)

function ColorPicker:init()
    self.Maid = Maid.new()
    local InitialHue,
          InitialSaturation,
          InitialBrightness = (self.props.InitialColor or Color3.fromHSV(0, 0.5, 1)):ToHSV()
    self.HSV, self._SetHSV = Roact.createBinding({
        H = InitialHue;
        S = InitialSaturation;
        V = InitialBrightness;
    })
end

function ColorPicker:didUpdate(previousProps)
    if previousProps.InitialColor ~= self.props.InitialColor then
        local InitialHue,
            InitialSaturation,
            InitialBrightness = (self.props.InitialColor or Color3.fromHSV(0, 0.5, 1)):ToHSV()
        self._SetHSV({
            H = InitialHue;
            S = InitialSaturation;
            V = InitialBrightness;
        })
    end
end

function ColorPicker:SetHSV(HSV)
    self._SetHSV(HSV)
    if self.props.SetPreviewColor then
        fastSpawn(function ()
            self.props.SetPreviewColor(Color3.fromHSV(HSV.H, HSV.S, HSV.V))
        end)
    end
end

function ColorPicker:Finish()
    if self.props.SetPreviewColor then
        fastSpawn(function ()
            self.props.SetPreviewColor(nil)
        end)
    end
    if self.props.OnConfirm then
        local HSV = self.HSV:getValue()
        local Color = Color3.fromHSV(HSV.H, HSV.S, HSV.V)
        fastSpawn(function ()
            self.props.OnConfirm(Color)
        end)
    end
end

function ColorPicker:Cancel()
    if self.props.SetPreviewColor then
        fastSpawn(function ()
            self.props.SetPreviewColor(nil)
        end)
    end
    if self.props.OnCancel then
        fastSpawn(function ()
            self.props.OnCancel()
        end)
    end
end

function ColorPicker:render()
    return new('ScreenGui', {
        DisplayOrder = 1;
    }, {
        Dialog = new('Frame', {
            Active = true;
            Draggable = true;
            ZIndex = 0;
            AnchorPoint = Vector2.new(1, 0.5);
            Position = self.DefaultPosition or UDim2.new(1, -110, 0.5, 0);
            BackgroundTransparency = 1;
            Size = UDim2.fromOffset(240, 0);
            [Roact.Change.Position] = function (rbx)
                ColorPicker.DefaultPosition = rbx.Position
            end;
        }, {
            Layout = new('UIListLayout', {
                FillDirection = Enum.FillDirection.Vertical;
                SortOrder = Enum.SortOrder.LayoutOrder;
                [Roact.Change.AbsoluteContentSize] = function (rbx)
                    rbx.Parent.Size = UDim2.fromOffset(240, rbx.AbsoluteContentSize.Y)
                end;
            });
            Picker = new('Frame', {
                BackgroundTransparency = 1;
                BorderSizePixel = 0;
                Size = UDim2.new(1, 0, 0, 0);
                LayoutOrder = 0;
            }, {
                Layout = new('UIListLayout', {
                    Padding = UDim.new(0, 10);
                    FillDirection = Enum.FillDirection.Horizontal;
                    SortOrder = Enum.SortOrder.LayoutOrder;
                    [Roact.Change.AbsoluteContentSize] = function (rbx)
                        rbx.Parent.Size = UDim2.new(1, 0, 0, rbx.AbsoluteContentSize.Y)
                    end;
                });
                Color = new('Frame', {
                    BorderSizePixel = 0;
                    Size = UDim2.new(0.25, 0, 1, 0);
                    BackgroundColor3 = self.HSV:map(function (HSV)
                        return Color3.fromHSV(HSV.H, HSV.S, HSV.V)
                    end);
                }, {
                    Corners = new('UICorner', {
                        CornerRadius = UDim.new(0, 4);
                    });
                    AspectRatio = new('UIAspectRatioConstraint', {
                        AspectRatio = 1;
                    });
                });
                Sliders = new('Frame', {
                    Position = UDim2.new(0.25, 5, 0, 0);
                    Size = UDim2.new(0.75, 0, 0, 0);
                    BackgroundTransparency = 1;
                }, {
                    Layout = new('UIListLayout', {
                        Padding = UDim.new(0, 10);
                        FillDirection = Enum.FillDirection.Vertical;
                        HorizontalAlignment = Enum.HorizontalAlignment.Left;
                        VerticalAlignment = Enum.VerticalAlignment.Top;
                        SortOrder = Enum.SortOrder.LayoutOrder;
                        [Roact.Change.AbsoluteContentSize] = function (rbx)
                            rbx.Parent.Size = UDim2.new(0.75, 0, 0, rbx.AbsoluteContentSize.Y)
                        end;
                    });
                    HueSlider = new(Slider, {
                        Size = UDim2.new(1, 0, 0, 10);
                        BackgroundColor3 = Color3.fromRGB(255, 255, 255);
                        LayoutOrder = 0;
                        Value = self.HSV:map(function (HSV)
                            return HSV.H
                        end);
                        OnValueChanged = function (Value)
                            local HSV = self.HSV:getValue()
                            self:SetHSV({
                                H = Value;
                                S = HSV.S;
                                V = HSV.V;
                            })
                        end;
                    }, {
                        Gradient = new('UIGradient', {
                            Color = self.HSV:map(function (HSV)
                                return ColorSequence.new({
                                    ColorSequenceKeypoint.new(0/6, Color3.fromHSV(0/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(1/6, Color3.fromHSV(1/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(2/6, Color3.fromHSV(2/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(3/6, Color3.fromHSV(3/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(4/6, Color3.fromHSV(4/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(5/6, Color3.fromHSV(5/6, HSV.S, HSV.V));
                                    ColorSequenceKeypoint.new(6/6, Color3.fromHSV(6/6, HSV.S, HSV.V));
                                })
                            end);
                        });
                    });
                    SaturationSlider = new(Slider, {
                        Size = UDim2.new(1, 0, 0, 10);
                        BackgroundColor3 = Color3.fromRGB(255, 255, 255);
                        LayoutOrder = 1;
                        Value = self.HSV:map(function (HSV)
                            return HSV.S
                        end);
                        OnValueChanged = function (Value)
                            local HSV = self.HSV:getValue()
                            self:SetHSV({
                                H = HSV.H;
                                S = Value;
                                V = HSV.V;
                            })
                        end;
                    }, {
                        Gradient = new('UIGradient', {
                            Color = self.HSV:map(function (HSV)
                                return ColorSequence.new(
                                    Color3.fromHSV(HSV.H, 0, HSV.V),
                                    Color3.fromHSV(HSV.H, 1, HSV.V)
                                )
                            end);
                        });
                    });
                    BrightnessSlider = new(Slider, {
                        Size = UDim2.new(1, 0, 0, 10);
                        BackgroundColor3 = Color3.fromRGB(255, 255, 255);
                        LayoutOrder = 2;
                        Value = self.HSV:map(function (HSV)
                            return HSV.V
                        end);
                        OnValueChanged = function (Value)
                            local HSV = self.HSV:getValue()
                            self:SetHSV({
                                H = HSV.H;
                                S = HSV.S;
                                V = Value;
                            })
                        end;
                    }, {
                        Gradient = new('UIGradient', {
                            Color = self.HSV:map(function (HSV)
                                return ColorSequence.new(
                                    Color3.fromHSV(HSV.H, HSV.S, 0),
                                    Color3.fromHSV(HSV.H, HSV.S, 1)
                                )
                            end);
                        });
                    });
                });
            });
            Bottom = new('Frame', {
                BackgroundTransparency = 1;
                BorderSizePixel = 0;
                Size = UDim2.new(1, 0, 0, 34);
                LayoutOrder = 1;
            }, {
                HSVLabel = new('TextLabel', {
                    BackgroundTransparency = 1;
                    Position = UDim2.new(0, 0, 0, 7);
                    Font = Enum.Font.GothamBlack;
                    Text = 'HSV: ';
                    TextSize = 11;
                    TextColor3 = Color3.fromRGB(255, 255, 255);
                    TextStrokeTransparency = 0.95;
                    [Roact.Change.TextBounds] = function (rbx)
                        rbx.Size = UDim2.fromOffset(rbx.TextBounds.X, rbx.TextBounds.Y)
                    end;
                }, {
                    HSVInput = new('TextBox', {
                        BackgroundTransparency = 1;
                        Position = UDim2.new(1, 0, 0, 0);
                        ClearTextOnFocus = false;
                        Font = Enum.Font.Gotham;
                        Text = self.HSV:map(function (HSV)
                            local Hue = tostring(math.floor(HSV.H * 360)) .. '°'
                            local Saturation = tostring(math.floor(HSV.S * 100)) .. '%'
                            local Brightness = tostring(math.floor(HSV.V * 100)) .. '%'
                            return Hue .. ', ' .. Saturation .. ', ' .. Brightness
                        end);
                        TextSize = 11;
                        TextColor3 = Color3.fromRGB(255, 255, 255);
                        TextStrokeTransparency = 0.95;
                        TextXAlignment = Enum.TextXAlignment.Left;
                        [Roact.Change.TextBounds] = function (rbx)
                            rbx.Size = UDim2.fromOffset(rbx.TextBounds.X, rbx.TextBounds.Y)
                        end;
                        [Roact.Event.FocusLost] = function (rbx)
                            local HueInput, SaturationInput, BrightnessInput = rbx.Text:match('([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)')
                            if HueInput and SaturationInput and BrightnessInput then
                                self:SetHSV({
                                    H = math.clamp(tonumber(HueInput) / 360, 0, 1);
                                    S = math.clamp(tonumber(SaturationInput) / 100, 0, 1);
                                    V = math.clamp(tonumber(BrightnessInput) / 100, 0, 1);
                                })
                            end
                        end;
                    });
                });
                RGBLabel = new('TextLabel', {
                    BackgroundTransparency = 1;
                    Position = UDim2.new(0, 0, 0, 7 + 11 + 4);
                    Font = Enum.Font.GothamBlack;
                    Text = 'RGB: ';
                    TextSize = 11;
                    TextColor3 = Color3.fromRGB(255, 255, 255);
                    TextStrokeTransparency = 0.95;
                    [Roact.Change.TextBounds] = function (rbx)
                        rbx.Size = UDim2.fromOffset(rbx.TextBounds.X, rbx.TextBounds.Y)
                    end;
                }, {
                    RGBInput = new('TextBox', {
                        BackgroundTransparency = 1;
                        Position = UDim2.new(1, 0, 0, 0);
                        ClearTextOnFocus = false;
                        Font = Enum.Font.Gotham;
                        Text = self.HSV:map(function (HSV)
                            local Color = Color3.fromHSV(HSV.H, HSV.S, HSV.V)
                            local R = tostring(math.round(Color.R * 255))
                            local G = tostring(math.round(Color.G * 255))
                            local B = tostring(math.round(Color.B * 255))
                            return R .. ', ' .. G .. ', ' .. B
                        end);
                        TextSize = 11;
                        TextColor3 = Color3.fromRGB(255, 255, 255);
                        TextStrokeTransparency = 0.95;
                        TextXAlignment = Enum.TextXAlignment.Left;
                        [Roact.Change.TextBounds] = function (rbx)
                            rbx.Size = UDim2.fromOffset(rbx.TextBounds.X, rbx.TextBounds.Y)
                        end;
                        [Roact.Event.FocusLost] = function (rbx)
                            local RInput, GInput, BInput = rbx.Text:match('([0-9]+)[^0-9]+([0-9]+)[^0-9]+([0-9]+)')
                            if RInput and GInput and BInput then
                                local Color = Color3.fromRGB(
                                    math.clamp(tonumber(RInput), 0, 255),
                                    math.clamp(tonumber(GInput), 0, 255),
                                    math.clamp(tonumber(BInput), 0, 255)
                                )
                                local H, S, V = Color:ToHSV()
                                self:SetHSV({
                                    H = H;
                                    S = S;
                                    V = V;
                                })
                            end
                        end;
                    });
                });

                ConfirmButton = new('ImageButton', {
                    BackgroundTransparency = 1;
                    Size = UDim2.new(0, 23, 0, 23);
                    Position = UDim2.new(1, 0, 1, 0);
                    AnchorPoint = Vector2.new(1, 1);
                    Image = 'rbxassetid://2132729935';
                    ScaleType = Enum.ScaleType.Slice;
                    SliceCenter = Rect.new(8, 8, 34, 34);
                    SliceScale = 0.5;
                    [Roact.Event.Activated] = function (rbx)
                        self:Finish()
                    end;
                }, {
                    Label = new('TextLabel', {
                        BackgroundTransparency = 1;
                        Size = UDim2.new(1, 0, 1, 0);
                        Text = '✔';
                        Font = Enum.Font.GothamSemibold;
                        TextSize = 12;
                        TextColor3 = Color3.fromRGB(0, 0, 0);
                    });
                });
                CancelButton = new('ImageButton', {
                    BackgroundTransparency = 1;
                    Size = UDim2.new(0, 25, 0, 23);
                    Position = UDim2.new(1, -30, 1, 0);
                    AnchorPoint = Vector2.new(1, 1);
                    Image = 'rbxassetid://2218340938';
                    ScaleType = Enum.ScaleType.Slice;
                    SliceCenter = Rect.new(8, 8, 34, 34);
                    SliceScale = 0.5;
                    [Roact.Event.Activated] = function (rbx)
                        self:Cancel()
                    end;
                }, {
                    Label = new('TextLabel', {
                        BackgroundTransparency = 1;
                        Size = UDim2.new(1, 0, 1, 0);
                        Text = 'Cancel';
                        Font = Enum.Font.GothamSemibold;
                        TextColor3 = Color3.fromRGB(255, 255, 255);
                        TextSize = 12;
                        TextStrokeTransparency = 0.95;
                        [Roact.Change.TextBounds] = function (rbx)
                            rbx.Parent.Size = UDim2.new(0, rbx.TextBounds.X + 10, 0, 23);
                        end;
                    });
                });
            });
        })
    })
end

return ColorPicker


Prompt: -- Set up the Local Player

Response:
if RunService:IsClient() then
	if LocalPlayer.Character then
		onCharacterAdded(LocalPlayer.Character)
	end
	LocalPlayer.CharacterAdded:Connect(onCharacterAdded)
	LocalPlayer.CharacterRemoving:Connect(onCharacterRemoving)
end

local ShoulderCamera = {}
ShoulderCamera.__index = ShoulderCamera
ShoulderCamera.SpringService = nil

function ShoulderCamera.new(weaponsSystem)
	local self = setmetatable({}, ShoulderCamera)
	self.weaponsSystem = weaponsSystem

	-- Configuration parameters (constants)
	self.fieldOfView = 70
	self.minPitch = math.rad(-75) -- min degrees camera can angle down
	self.maxPitch = math.rad(75) -- max degrees camera can cangle up
	self.normalOffset = Vector3.new(2.25, 2.25, 10.5) -- this is the camera's offset from the player
	self.zoomedOffsetDistance = 8 -- number of studs to zoom in from default offset when zooming
	self.normalCrosshairScale = 1
	self.zoomedCrosshairScale = 0.75
	self.defaultZoomFactor = 1
	self.canZoom = true
	self.zoomInputs = { Enum.UserInputType.MouseButton2, Enum.KeyCode.ButtonL2 }
	self.sprintInputs = { Enum.KeyCode.LeftShift }
	self.mouseRadsPerPixel = Vector2.new(1 / 480, 1 / 480)
	self.zoomedMouseRadsPerPixel = Vector2.new(1 / 1200, 1 / 1200)
	self.touchSensitivity = Vector2.new(1 / 100, 1 / 100)
	self.zoomedTouchSensitivity = Vector2.new(1 / 200, 1 / 200)
	self.touchDelayTime = 0.25 -- max time for a touch to count as a tap (to shoot the weapon instead of control camera),
	                           -- also the amount of time players have to start a second touch after releasing the first time to trigger automatic fire
	self.recoilDecay = 2 -- higher number means faster recoil decay rate
	self.rotateCharacterWithCamera = true
	self.gamepadSensitivityModifier = Vector2.new(0.85, 0.65)
	-- Walk speeds
	self.zoomWalkSpeed = 8
	self.normalWalkSpeed = 16
	self.sprintingWalkSpeed = 24

	-- Current state
	self.enabled = false
	self.yaw = 0
	self.pitch = 0
	self.currentCFrame = CFrame.new()
	self.currentOffset = self.normalOffset
	self.currentRecoil = Vector2.new(0, 0)
	self.currentMouseRadsPerPixel = self.mouseRadsPerPixel
	self.currentTouchSensitivity = self.touchSensitivity
	self.mouseLocked = true
	self.touchPanAccumulator = Vector2.new(0, 0) -- used for touch devices, represents amount the player has dragged their finger since starting a touch
	self.currentTool = nil
	self.sprintingInputActivated = false
	self.desiredWalkSpeed = self.normalWalkSpeed
	self.sprintEnabled = false -- true means player will move faster while doing sprint inputs
	self.slowZoomWalkEnabled = false -- true means player will move slower while doing zoom inputs
	self.desiredFieldOfView = self.fieldOfView
	-- Zoom variables
	self.zoomedFromInput = false -- true if player has performed input to zoom
	self.forcedZoomed = false -- ignores zoomedFromInput and canZoom
	self.zoomState = false -- true if player is currently zoomed in
	self.zoomAlpha = 0
	self.hasScope = false
	self.hideToolWhileZoomed = false
	self.currentZoomFactor = self.defaultZoomFactor
	self.zoomedFOV = self.fieldOfView
	-- Gamepad variables
	self.gamepadPan = Vector2.new(0, 0) -- essentially the amount the gamepad has moved from resting position
	self.movementPan = Vector2.new(0, 0) -- this is for movement (gamepadPan is for camera)
	self.lastThumbstickPos = Vector2.new(0, 0)
	self.lastThumbstickTime = nil
	self.currentGamepadSpeed = 0
	self.lastGamepadVelocity = Vector2.new(0, 0)

	-- Occlusion
	self.lastOcclusionDistance = 0
	self.lastOcclusionReachedTime = 0 -- marks the last time camera was at the true occlusion distance
	self.defaultTimeUntilZoomOut = 0
	self.timeUntilZoomOut = self.defaultTimeUntilZoomOut -- time after lastOcclusionReachedTime that camera will zoom out
	self.timeLastPoppedWayIn = 0 -- this holds the last time camera popped nearly into first person
	self.isZoomingOut = false
	self.tweenOutTime = 0.2
	self.curOcclusionTween = nil
	self.occlusionTweenObject = nil

	-- Side correction (when player is against a wall)
	self.sideCorrectionGoalVector = nil
	self.lastSideCorrectionMagnitude = 0
	self.lastSideCorrectionReachedTime = 0 -- marks the last time the camera was at the true correction distance
	self.revertSideCorrectionSpeedMultiplier = 2 -- speed at which camera reverts the side correction (towards 0 correction)
	self.defaultTimeUntilRevertSideCorrection = 0.75
	self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection -- time after lastSideCorrectionReachedTime that camera will revert the correction
	self.isRevertingSideCorrection = false

	-- Datamodel references
	self.eventConnections = {}
	self.raycastIgnoreList = {}
	self.currentCamera = nil
	self.currentCharacter = nil
	self.currentHumanoid = nil
	self.currentRootPart = nil
	self.controlModule = nil -- used to get player's touch input for moving character
	self.random = Random.new()

	return self
end

function ShoulderCamera:setEnabled(enabled)
	if self.enabled == enabled then
		return
	end
	self.enabled = enabled

	if self.enabled then
		RunService:BindToRenderStep(CAMERA_RENDERSTEP_NAME, Enum.RenderPriority.Camera.Value - 1, function(dt) self:onRenderStep(dt) end)
		ContextActionService:BindAction(ZOOM_ACTION_NAME, function(...) self:onZoomAction(...) end, false, unpack(self.zoomInputs))
		ContextActionService:BindAction(SPRINT_ACTION_NAME, function(...) self:onSprintAction(...) end, false, unpack(self.sprintInputs))

		table.insert(self.eventConnections, LocalPlayer.CharacterAdded:Connect(function(character) self:onCurrentCharacterChanged(character) end))
		table.insert(self.eventConnections, LocalPlayer.CharacterRemoving:Connect(function() self:onCurrentCharacterChanged(nil) end))
		table.insert(self.eventConnections, workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() self:onCurrentCameraChanged(workspace.CurrentCamera) end))
		table.insert(self.eventConnections, UserInputService.InputBegan:Connect(function(inputObj, wasProcessed) self:onInputBegan(inputObj, wasProcessed) end))
		table.insert(self.eventConnections, UserInputService.InputChanged:Connect(function(inputObj, wasProcessed) self:onInputChanged(inputObj, wasProcessed) end))
		table.insert(self.eventConnections, UserInputService.InputEnded:Connect(function(inputObj, wasProcessed) self:onInputEnded(inputObj, wasProcessed) end))

		self:onCurrentCharacterChanged(LocalPlayer.Character)
		self:onCurrentCameraChanged(workspace.CurrentCamera)

		-- Make transition to shouldercamera smooth by facing in same direction as previous camera
		local cameraLook = self.currentCamera.CFrame.lookVector
		self.yaw = math.atan2(-cameraLook.X, -cameraLook.Z)
		self.pitch = math.asin(cameraLook.Y)

		self.currentCamera.CameraType = Enum.CameraType.Scriptable

		self:setZoomFactor(self.currentZoomFactor) -- this ensures that zoomedFOV reflecs currentZoomFactor

		workspace.CurrentCamera.CameraSubject = self.currentRootPart

		self.occlusionTweenObject = Instance.new("NumberValue")
		self.occlusionTweenObject.Name = "OcclusionTweenObject"
		self.occlusionTweenObject.Parent = script
		self.occlusionTweenObject.Changed:Connect(function(value)
			self.lastOcclusionDistance = value
		end)

		-- Sets up weapon system to use camera for raycast direction instead of gun look vector
		self.weaponsSystem.aimRayCallback = function()
			local cameraCFrame = self.currentCFrame
			return Ray.new(cameraCFrame.p, cameraCFrame.LookVector * 500)
		end
	else
		RunService:UnbindFromRenderStep(CAMERA_RENDERSTEP_NAME)
		ContextActionService:UnbindAction(ZOOM_ACTION_NAME)
		ContextActionService:UnbindAction(SPRINT_ACTION_NAME)

		if self.currentHumanoid then
			self.currentHumanoid.AutoRotate = true
		end

		if self.currentCamera then
			self.currentCamera.CameraSubject = self.currentHumanoid
			self.currentCamera.CameraType = Enum.CameraType.Custom
		end

		self:updateZoomState()

		self.yaw = 0
		self.pitch = 0

		for _, conn in pairs(self.eventConnections) do
			conn:Disconnect()
		end
		self.eventConnections = {}

		UserInputService.MouseBehavior = Enum.MouseBehavior.Default
		UserInputService.MouseIconEnabled = true
	end
end

function ShoulderCamera:onRenderStep(dt)
	if not self.enabled or
	   not self.currentCamera or
	   not self.currentCharacter or
	   not self.currentHumanoid or
	   not self.currentRootPart
	then
		return
	end

	-- Hide mouse and lock to center if applicable
	if self.mouseLocked and not GuiService:GetEmotesMenuOpen() then
		UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
		UserInputService.MouseIconEnabled = false
	else
		UserInputService.MouseBehavior = Enum.MouseBehavior.Default
		UserInputService.MouseIconEnabled = true
	end

	-- Handle gamepad input
	self:processGamepadInput(dt)

	-- Smoothly zoom to desired values
	if self.hasScope then
		ShoulderCamera.SpringService:Target(self, 0.8, 8, { zoomAlpha = self.zoomState and 1 or 0 })
		ShoulderCamera.SpringService:Target(self.currentCamera, 0.8, 8, { FieldOfView = self.desiredFieldOfView })
	else
		ShoulderCamera.SpringService:Target(self, 0.8, 3, { zoomAlpha = self.zoomState and 1 or 0 })
		ShoulderCamera.SpringService:Target(self.currentCamera, 0.8, 3, { FieldOfView = self.desiredFieldOfView })
	end

	-- Handle walk speed changes
	if self.sprintEnabled or self.slowZoomWalkEnabled then
		self.desiredWalkSpeed = self.normalWalkSpeed
		if self.sprintEnabled and (self.sprintingInputActivated or self:sprintFromTouchInput() or self:sprintFromGamepadInput()) and not self.zoomState then
			self.desiredWalkSpeed = self.sprintingWalkSpeed
		end
		if self.slowZoomWalkEnabled and self.zoomAlpha > 0.1 then
			self.desiredWalkSpeed = self.zoomWalkSpeed
		end

		ShoulderCamera.SpringService:Target(self.currentHumanoid, 0.95, 4, { WalkSpeed = self.desiredWalkSpeed })
	end

	-- Initialize variables used for side correction, occlusion, and calculating camera focus/rotation
	local rootPartPos = self.currentRootPart.CFrame.Position
	local rootPartUnrotatedCFrame = CFrame.new(rootPartPos)
	local yawRotation = CFrame.Angles(0, self.yaw, 0)
	local pitchRotation = CFrame.Angles(self.pitch + self.currentRecoil.Y, 0, 0)
	local xOffset = CFrame.new(self.normalOffset.X, 0, 0)
	local yOffset = CFrame.new(0, self.normalOffset.Y, 0)
	local zOffset = CFrame.new(0, 0, self.normalOffset.Z)
	local collisionRadius = self:getCollisionRadius()
	local cameraYawRotationAndXOffset =
		yawRotation * 		-- First rotate around the Y axis (look left/right)
		xOffset 			-- Then perform the desired offset (so camera is centered to side of player instead of directly on player)
	local cameraFocus = rootPartUnrotatedCFrame * cameraYawRotationAndXOffset

	-- Handle/Calculate side correction when player is adjacent to a wall (so camera doesn't go in the wall)
	local vecToFocus = cameraFocus.p - rootPartPos
	local rayToFocus = Ray.new(rootPartPos, vecToFocus + (vecToFocus.Unit * collisionRadius))
	local hitPart, hitPoint, hitNormal = self:penetrateCast(rayToFocus, self.raycastIgnoreList)
	local currentTime = tick()
	local sideCorrectionGoalVector = Vector3.new() -- if nothing is adjacent to player, goal vector is (0, 0, 0)
	if hitPart then
		hitPoint = hitPoint + (hitNormal * collisionRadius)
		sideCorrectionGoalVector = hitPoint - cameraFocus.p
		if sideCorrectionGoalVector.Magnitude >= self.lastSideCorrectionMagnitude then -- make it easy for camera to pop closer to player (move left)
			if currentTime > self.lastSideCorrectionReachedTime + self.timeUntilRevertSideCorrection and self.lastSideCorrectionMagnitude ~= 0 then
				self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection * 2 -- double time until revert if popping in repeatedly
			elseif self.lastSideCorrectionMagnitude == 0 and self.timeUntilRevertSideCorrection ~= self.defaultTimeUntilRevertSideCorrection then
				self.timeUntilRevertSideCorrection = self.defaultTimeUntilRevertSideCorrection
			end
			self.lastSideCorrectionMagnitude = sideCorrectionGoalVector.Magnitude
			self.lastSideCorrectionReachedTime = currentTime
			self.isRevertingSideCorrection = false
		else
			self.isRevertingSideCorrection = true
		end
	elseif self.lastSideCorrectionMagnitude ~= 0 then
		self.isRevertingSideCorrection = true
	end
	if self.isRevertingSideCorrection then -- make it hard/slow for camera to revert side correction (move right)
		if sideCorrectionGoalVector.Magnitude > self.lastSideCorrectionMagnitude - 1 and sideCorrectionGoalVector.Magnitude ~= 0 then
			self.lastSideCorrectionReachedTime = currentTime -- reset timer if occlusion significantly increased since last frame
		end
		if currentTime > self.lastSideCorrectionReachedTime + self.timeUntilRevertSideCorrection then
			local sideCorrectionChangeAmount = dt * (vecToFocus.Magnitude) * self.revertSideCorrectionSpeedMultiplier
			self.lastSideCorrectionMagnitude = self.lastSideCorrectionMagnitude - sideCorrectionChangeAmount
			if sideCorrectionGoalVector.Magnitude >= self.lastSideCorrectionMagnitude then
				self.lastSideCorrectionMagnitude = sideCorrectionGoalVector.Magnitude
				self.lastSideCorrectionReachedTime = currentTime
				self.isRevertingSideCorrection = false
			end
		end
	end

	-- Update cameraFocus to reflect side correction
	cameraYawRotationAndXOffset = cameraYawRotationAndXOffset + (-vecToFocus.Unit * self.lastSideCorrectionMagnitude)
	cameraFocus = rootPartUnrotatedCFrame * cameraYawRotationAndXOffset
	self.currentCamera.Focus = cameraFocus

	-- Calculate and apply CFrame for camera
	local cameraCFrameInSubjectSpace =
		cameraYawRotationAndXOffset *
		pitchRotation * 	-- rotate around the X axis (look up/down)
		yOffset *			-- move camera up/vertically
		zOffset				-- move camera back
	self.currentCFrame = rootPartUnrotatedCFrame * cameraCFrameInSubjectSpace

	-- Move camera forward if zoomed in
	if self.zoomAlpha > 0 then
		local trueZoomedOffset = math.max(self.zoomedOffsetDistance - self.lastOcclusionDistance, 0) -- don't zoom too far in if already occluded
		self.currentCFrame = self.currentCFrame:lerp(self.currentCFrame + trueZoomedOffset * self.currentCFrame.LookVector.Unit, self.zoomAlpha)
	end

	self.currentCamera.CFrame = self.currentCFrame

	-- Handle occlusion
	local occlusionDistance = self.currentCamera:GetLargestCutoffDistance(self.raycastIgnoreList)
	if occlusionDistance > 1e-5 then
		occlusionDistance = occlusionDistance + collisionRadius
	end
	if occlusionDistance >= self.lastOcclusionDistance then -- make it easy for the camera to pop in towards the player
		if self.curOcclusionTween ~= nil then
			self.curOcclusionTween:Cancel()
			self.curOcclusionTween = nil
		end
		if currentTime > self.lastOcclusionReachedTime + self.timeUntilZoomOut and self.lastOcclusionDistance ~= 0 then
			self.timeUntilZoomOut = self.defaultTimeUntilZoomOut * 2 -- double time until zoom out if popping in repeatedly
		elseif self.lastOcclusionDistance == 0  and self.timeUntilZoomOut ~= self.defaultTimeUntilZoomOut then
			self.timeUntilZoomOut = self.defaultTimeUntilZoomOut
		end

		if occlusionDistance / self.normalOffset.Z > 0.8 and self.timeLastPoppedWayIn == 0 then
			self.timeLastPoppedWayIn = currentTime
		end

		self.lastOcclusionDistance = occlusionDistance
		self.lastOcclusionReachedTime = currentTime
		self.isZoomingOut = false
	else -- make it hard/slow for camera to zoom out
		self.isZoomingOut = true
		if occlusionDistance > self.lastOcclusionDistance - 2 and occlusionDistance ~= 0 then -- reset timer if occlusion significantly increased since last frame
			self.lastOcclusionReachedTime = currentTime
		end

		-- If occlusion pops camera in to almost first person for a short time, pop out instantly
		if currentTime < self.timeLastPoppedWayIn + self.defaultTimeUntilZoomOut and self.lastOcclusionDistance / self.normalOffset.Z > 0.8 then
			self.lastOcclusionDistance = occlusionDistance
			self.lastOcclusionReachedTime = currentTime
			self.isZoomingOut = false
		elseif currentTime >= self.timeLastPoppedWayIn + self.defaultTimeUntilZoomOut and self.timeLastPoppedWayIn ~= 0 then
			self.timeLastPoppedWayIn = 0
		end
	end

	-- Update occlusion amount if timeout time has passed
	if currentTime >= self.lastOcclusionReachedTime + self.timeUntilZoomOut and not self.zoomState then
		if self.curOcclusionTween == nil then
			self.occlusionTweenObject.Value = self.lastOcclusionDistance
			local tweenInfo = TweenInfo.new(self.tweenOutTime)
			local goal = {}
			goal.Value = self.lastOcclusionDistance - self.normalOffset.Z
			self.curOcclusionTween = TweenService:Create(self.occlusionTweenObject, tweenInfo, goal)
			self.curOcclusionTween:Play()
		end
	end

	-- Apply occlusion to camera CFrame
	local currentOffsetDir = self.currentCFrame.LookVector.Unit
	self.currentCFrame = self.currentCFrame + (currentOffsetDir * self.lastOcclusionDistance)
	self.currentCamera.CFrame = self.currentCFrame

	-- Apply recoil decay
	self.currentRecoil = self.currentRecoil - (self.currentRecoil * self.recoilDecay * dt)

	if self:isHumanoidControllable() and self.rotateCharacterWithCamera then
		self.currentHumanoid.AutoRotate = false
		self.currentRootPart.CFrame = CFrame.Angles(0, self.yaw, 0) + self.currentRootPart.Position -- rotate character to be upright and facing the same direction as camera
		self:applyRootJointFix()
	else
		self.currentHumanoid.AutoRotate = true
	end

	self:handlePartTransparencies()
	self:handleTouchToolFiring()
end


Prompt: --Made by Luckymaxer

Response:
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Fire = Handle:WaitForChild("Fire")

Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")

RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create

DeathEffect = script:WaitForChild("DeathEffect")

DamageValues = {
	BaseDamage = 44,
	SlashDamage = 50,
	LungeDamage = 56,
}

Damage = DamageValues.BaseDamage

BaseUrl = "http://www.roblox.com/asset/?id="

BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false

Special = {
	Active = false,
	Enabled = true,
	Duration = 15,
	CoolDown = 10,
}

Animations = {
	Equip = {Animation = Tool:WaitForChild("Equip"), FadeTime = nil, Weight = nil, Speed = 0.7, Duration = 1},
	LeftSlash = {Animation = Tool:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
	RightSlash = {Animation = Tool:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
	SideSwipe = {Animation = Tool:WaitForChild("SideSwipe"), FadeTime = nil, Weight = nil, Speed = 0.8, Duration = 0.75},
	Explode = {Animation = Tool:WaitForChild("Explode"), FadeTime = 0.25, Weight = nil, Speed = 2, Duration = 0.75},
}

Sounds = {
	Unsheath = Handle:WaitForChild("Unsheath"),
	Slash = Handle:WaitForChild("Slash"),
	Lunge = Handle:WaitForChild("Lunge"),
}

Grips = {
	Up = CFrame.new(0, -1.85, 0.05, 1, 0, -0, 0, 1, 0, 0, 0, 1),
	Out = CFrame.new(0, -1.85, 0.05, 1, 0, 0, 0, 0, -1, -0, 1, 0),
}

LastAttack = 0

ToolEquipped = false

ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
	Name = "ServerControl",
	Parent = Tool,
})

ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
	Name = "ClientControl",
	Parent = Tool,
})

Handle.Transparency = 0
Fire.Enabled = false
Tool.Grip = Grips.Up
Tool.Enabled = true

function IsTeamMate(Player1, Player2)
	return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end

function TagHumanoid(humanoid, player)
	local Creator_Tag = Create("ObjectValue"){
		Name = "creator",
		Value = player,
	}
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

function UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end

function CheckTableForInstance(Table, Instance)
	for i, v in pairs(Table) do
		if v == Instance then
			return true
		end
	end
	return false
end

function GetTotalParts(MaxParts, PossibleParts, Parts)
	if MaxParts < PossibleParts then
		return MaxParts
	elseif Parts >= MaxParts then
		return 0
	elseif MaxParts >= PossibleParts then
		local PartCount = (MaxParts - PossibleParts)
		if Parts <= MaxParts then
			PartCount = (MaxParts - Parts)
			if PartCount > PossibleParts then
				return PossibleParts
			else
				return PartCount
			end
		elseif PartCount >= PossibleParts then
			return PossibleParts
		else
			return PartCount
		end
	end
end

function GetParts(Region, MaxParts, Ignore)
	local Parts = {}
	local RerunFailed = false
	while #Parts < MaxParts and not RerunFailed do
		local Region = Region
		local PossibleParts = GetTotalParts(MaxParts, 3000, #Parts)
		local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts)
		if #PartsNearby == 0 then
			RerunFailed = true
		else
			for i, v in pairs(PartsNearby) do
				table.insert(Parts, v)
				table.insert(Ignore, v)
			end
		end
	end
	return Parts
end

function ApplyDeathEffect(character, Direction, Force)
	local Direction = (Direction or Vector3.new(0, 0, 0))
	local Force = (Force or Vector3.new(0, 0, 0))
	local humanoid = character:FindFirstChild("Humanoid")
	if not humanoid then
		return
	end
	local DeathEffectCopy = character:FindFirstChild(DeathEffect.Name)
	if DeathEffectCopy then
		return
	end
	DeathEffectCopy = DeathEffect:Clone()
	DeathEffectCopy.WindDirection.Value = Direction
	DeathEffectCopy.Force.Value = Force
	DeathEffectCopy.Disabled = false
	DeathEffectCopy.Parent = character
end

function DealDamage(character, damage)
	if not CheckIfAlive() or not character then
		return
	end
	local damage = (damage or 0)
	local humanoid = character:FindFirstChild("Humanoid")
	local rootpart = character:FindFirstChild("HumanoidRootPart")
	if not rootpart then
		rootpart = character:FindFirstChild("Torso")
	end
	if not humanoid or humanoid.Health == 0 or not rootpart then
		return
	end
	UntagHumanoid(humanoid)
	TagHumanoid(humanoid, Player)
	humanoid:TakeDamage(damage)
	if humanoid.Health <= 0 then
		local WindDir = (CFrame.new(RootPart.Position, Vector3.new(rootpart.Position.X, RootPart.Position.Y, rootpart.Position.Z)) * CFrame.Angles(0, math.pi, 0)).lookVector
		ApplyDeathEffect(character, Vector3.new(WindDir.X, 1, WindDir.Z), ((WindDir * 6.5) + Vector3.new(0, 15, 0)))
	end
end

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end

function Blow(Part)
	local PartTouched
	local HitDelay = false
	PartTouched = Part.Touched:connect(function(Hit)
		if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped or HitDelay then
			return
		end
		local RightArm = Character:FindFirstChild("Right Arm")
		if not RightArm then
			return
		end
		local RightGrip = RightArm:FindFirstChild("RightGrip")
		if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
			return
		end
		local character = Hit.Parent
		if character == Character or (Special.Active and RandomNearby and character ~= RandomNearby.Character) then
			return
		end
		local humanoid = character:FindFirstChild("Humanoid")
		local rootpart = character:FindFirstChild("HumanoidRootPart")
		if not rootpart then
			rootpart = character:FindFirstChild("Torso")
		end
		if not humanoid or humanoid.Health == 0 or not rootpart then
			return
		end
		local player = Players:GetPlayerFromCharacter(character)
		if player and (player == Player or IsTeamMate(Player, player)) then
			return
		end
		HitDelay = true
		local TotalDamage = (Damage * ((Special.Active and math.huge) or 1))
		DealDamage(character, TotalDamage)
		wait(0.05)
		HitDelay = false
	end)
end

function PossessedAttack()
	Fire.Enabled = true
	local CurrentlyEquipped = true
	if ToolUnequipped then
		ToolUnequipped:disconnect()
	end
	ToolUnequipped = Tool.Unequipped:connect(function()
		CurrentlyEquipped = false
	end)
	local SpecialStart = tick()
	while ToolEquipped and CurrentlyEquipped and CheckIfAlive() and (tick() - SpecialStart) < Special.Duration do
		local UserPlayer = Player
		local UserCharacter = Character
		local IgnoreObjects = {UserCharacter, Tool}
		local Radius = 35
		local Objects = {}
		local Humanoids = {}
		local PlayersNearby = {}
		local NegativeRadius = (RootPart.Position - Vector3.new(Radius, (RootPart.Size.Y * 1.25), Radius))
		local PositiveRadius = (RootPart.Position + Vector3.new(Radius, (Radius / 6), Radius))
		for i, v in pairs(Players:GetChildren()) do
			if v:IsA("Player") and v ~= UserPlayer then
				local character = v.Character
				if character and character.Parent then
					table.insert(IgnoreObjects, v)
					if not IsTeamMate(v, UserPlayer) then
						local humanoid = character:FindFirstChild("Humanoid")
						local rootpart = character:FindFirstChild("HumanoidRootPart")
						if not rootpart then
							rootpart = character:FindFirstChild("Torso")
						end
						if humanoid and humanoid.Health > 0 and (RootPart.Position - rootpart.Position).magnitude <= Radius then
							table.insert(Humanoids, humanoid)
						end
					end
				end
			end
		end
		if #Humanoids == 0 then
			local Parts = GetParts(Region3.new(NegativeRadius, PositiveRadius), 500, IgnoreObjects)
			for i, v in pairs(Parts) do
				if v and v.Parent and not CheckTableForInstance(Objects, v) then
					local character = v.Parent
					if character:IsA("Hat") or character:IsA("Tool") then
						character = character.Parent
					end
					local humanoid = character:FindFirstChild("Humanoid")
					local player = Players:GetPlayerFromCharacter(character)
					if not CheckTableForInstance(Humanoids, humanoid) and not CheckTableForInstance(PlayersNearby, character) then
						if humanoid and humanoid.Health > 0 and not CheckTableForInstance(Humanoids, humanoid) then
							table.insert(Humanoids, humanoid)
							if player and not CheckTableForInstance(PlayersNearby, player) then
								table.insert(PlayersNearby, player)
							end
						elseif (RootPart.Position - v.Position).magnitude <= Radius then
							table.insert(Objects, v)
						end
					end
				end
			end
		end
		local NearPlayers = {}
		for i, v in pairs(Humanoids) do
			local character = v.Parent
			local player = Players:GetPlayerFromCharacter(character)
			local rootpart = character:FindFirstChild("HumanoidRootPart")
			if not rootpart then
				rootpart = character:FindFirstChild("Torso")
			end
			if rootpart then
				table.insert(NearPlayers, {Character = character, Humanoid = v, RootPart = rootpart, Distance = (RootPart.Position - rootpart.Position).Magnitude})
			end
		end
		table.sort(NearPlayers, (function(a, b)
			return a.Distance < b.Distance
		end))
		if #NearPlayers > 0 then
			local MaxNearbyCount = 3
			local MaxNearby = ((#NearPlayers <= MaxNearbyCount and #NearPlayers) or MaxNearbyCount)
			RandomNearby = NearPlayers[math.random(1, MaxNearby)]
			local OrigPos = RootPart.CFrame
			local NewPos = (RandomNearby.RootPart.CFrame * CFrame.new(0, ((RootPart.Size.Z / 2) + (RandomNearby.RootPart.Size.Z / 2) + (RootPart.Size.Y / 2)), ((RootPart.Size.Z / 2) + (RandomNearby.RootPart.Size.Z / 2) + 0.75)))
			RootPart.CFrame = CFrame.new(NewPos.p, RandomNearby.RootPart.CFrame.p)
			RootPart.Anchored = true
			Attack()
			wait(1)
			RootPart.CFrame = OrigPos
			RootPart.Anchored = false
			wait(1.5)
		end
		wait()
	end
	Fire.Enabled = false
end

function Attack()
	Damage = DamageValues.SlashDamage
	Sounds.Slash:Play()
	--[[local Anim = Create("StringValue"){
		Name = "toolanim",
		Value = "Slash",
	}
	Debris:AddItem(Anim, 2)
	Anim.Parent = Tool]]
	local SwingAnimations = {Animations.LeftSlash, Animations.RightSlash, Animations.SideSwipe, Animations.Swing}
	local Animation = SwingAnimations[math.random(1, #SwingAnimations)]
	Spawn(function()
		InvokeClient("PlayAnimation", Animation)
	end)
end

function Lunge()
	Damage = DamageValues.LungeDamage
	Sounds.Lunge:Play()
	for i, v in pairs(Animations) do
		Spawn(function()
			InvokeClient("StopAnimation", v)
		end)
	end
	local Anim = Create("StringValue"){
		Name = "toolanim",
		Value = "Lunge",
	}
	Debris:AddItem(Anim, 2)
	Anim.Parent = Tool
	wait(0.2)
	Tool.Grip = Grips.Out
	wait(0.75)
	Tool.Grip = Grips.Up
	Damage = DamageValues.SlashDamage
end

function Activated()
	if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() or Special.Active then
		return
	end
	Tool.Enabled = false
	local Tick = RunService.Stepped:wait()
	if (Tick - LastAttack < 0.2) then
		Lunge()
	else
		Attack()
	end
	LastAttack = Tick
	--wait(0.5)
	Damage = DamageValues.BaseDamage
	Tool.Enabled = true
end

function CheckIfAlive()
	return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and RootPart and RootPart.Parent) and true) or false)
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	RootPart = Character:FindFirstChild("HumanoidRootPart")
	if not CheckIfAlive() then
		return
	end
	Sounds.Unsheath:Play()
	Spawn(function()
		if ToolUnequipped then
			ToolUnequipped:disconnect()
		end
		local CurrentlyEquipped = true
		ToolUnequipped = Tool.Unequipped:connect(function()
			CurrentlyEquipped = false
		end)
		local Animation = Animations.Equip
		Spawn(function()
			InvokeClient("PlayAnimation", Animation)
		end)
		wait(Animation.Duration)
		if ToolUnequipped then
			ToolUnequipped:disconnect()
		end
		if not CurrentlyEquipped then
			return
		end
		ToolEquipped = true
		Humanoid.WalkSpeed = (16 * 1.5)
	end)
end

function Unequipped()
	Humanoid.WalkSpeed = 16
	ToolEquipped = false
end

function OnServerInvoke(player, mode, value)
	if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
		return
	end
	if mode == "KeyPressed" then
		local Key = string.lower(value.Key)
		local Down = value.Down
		if Key == "q" and Down then
			if not Special.Enabled or Special.Active then
				return
			end
			Special.Enabled = false
			Special.Active = true
			PossessedAttack()
			Special.Active = false
			wait(Special.CoolDown)
			Special.Enabled = true
		end
	end
end

function InvokeClient(Mode, Value)
	local ClientReturn = nil
	pcall(function()
		ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
	end)
	return ClientReturn
end

ServerControl.OnServerInvoke = OnServerInvoke

Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

Blow(Handle)


Response:
local HoldAnim, ThrowAnim;

Tool.Equipped:connect(function(mouse)
	Character = Tool.Parent
	Player = game.Players:GetPlayerFromCharacter(Character)

	local HoldAnimSrc = WaitFor(Tool).HoldAnim()
	HoldAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743592'
	local ThrowAnimSrc = WaitFor(Tool).ThrowAnim()
	ThrowAnimSrc.AnimationId = 'http://www.roblox.com/asset/?id=88743566'

	HoldAnim = Character.Humanoid:LoadAnimation(HoldAnimSrc)
	ThrowAnim = Character.Humanoid:LoadAnimation(ThrowAnimSrc)

	--setup first anim / cursor cycle
	if Now() > NextFireAt.Value then
		Handle.Transparency = 0
		mouse.Icon = 'rbxasset://textures\\GunCursor.png'
		HoldAnim:Play()
	else
		Handle.Transparency = 1
		Delay(NextFireAt.Value - Now(), function()
			mouse.Icon = 'rbxasset://textures\\GunWaitCursor.png'
			Handle.Transparency = 0
			HoldAnim:Play()
		end)
	end

	mouse.Button1Down:connect(function()
		--we track the reload time like this so that the player can't fire faster with
		--rapid dis / re-equipping, which will actually be common usage with this gear.
		if Now() > NextFireAt.Value then
			NextFireAt.Value = Now() + RELOAD_TIME
			--
			local gr = Handle:Clone()
			gr.CanCollide = false
			local sc = GrenadeScript:Clone()
			sc.Parent = gr
			sc.Disabled = false
			WaitFor(sc).creator().Value = Player

			--calc velocity
			local toTarget = mouse.Hit.p - gr.Position
			local dy = toTarget.y
			toTarget = Vector3.new(toTarget.x, 0, toTarget.z)
			local dx = toTarget.magnitude
			toTarget = toTarget.unit

			Velocity = math.min(120, 40 + dx)

			local theta = computeLaunchAngle(dx, dy, 196.2)

			local vY = math.sin(theta)*Velocity
			local vX = toTarget.x * math.cos(theta) * Velocity
			local vZ = toTarget.z * math.cos(theta) * Velocity

			gr.CanCollide = false
			Delay(0.1, function()
				gr.CanCollide = true
			end)
			gr.Velocity = Vector3.new(vX, vY, vZ)
			gr.Parent = game.Workspace

			--play sound / anim
			ThrowSound:Play()
			HoldAnim:Stop(0)
			ThrowAnim:Play(0,1,1)

			--reload
			Handle.Transparency = 1
			mouse.Icon = 'rbxasset://textures\\GunWaitCursor.png'
			wait(RELOAD_TIME)
			HoldAnim:Play()
			Handle.Transparency = 0
			mouse.Icon = 'rbxasset://textures\\GunCursor.png'
		end
	end)
end)

Tool.Unequipped:connect(function()
	if ThrowSound then
		ThrowSound:Stop()
	end
	if ThrowAnim then
		ThrowAnim:Stop()
	end
	if HoldAnim then
		HoldAnim:Stop()
	end
end)


Prompt: --important stuff to register what is what. you need these if you want to do stuff with the tool itself.

Response:
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
for i,D in pairs(script.Parent:GetChildren()) do
if D.Name == "DP" then
if b == false then
if dmg == true then
b = true
D.Touched:connect(Blow)
wait(1)
b = false
end
end
end
end


Prompt: --Services

Response: local PathfindingService = game:GetService("PathfindingService")


Prompt: --//Controller//--

Response:
Spawners:Activate()

RunService.RenderStepped:Connect(function()
	if not DBOn then
		if Camera.CameraType ~= Enum.CameraType.Scriptable then
			Camera.CameraType = Enum.CameraType.Scriptable

		end

		Camera.CFrame = CamPart.CFrame

	end

end)


Prompt: --	scr.Disabled= false

Response: -- запускаем его в направлении пушки (смещаем в неправлении взгляда)


Prompt: -- Properties

Response:
local OptimalEffects = true
local RenderDistance = 400
local ScreenCullingEnabled = true
local ScreenCullingRadius = 16
FastCast.DebugLogging = false
FastCast.VisualizeCasts = false
FastCast.RayExit = true -- Only applies for Wall Penetration.

local Beam = Instance.new("Beam")
Beam.TextureSpeed = 0
Beam.LightEmission = 0
Beam.LightInfluence = 1
Beam.Transparency = NumberSequence.new(0)

local Caster = FastCast.new()

local function MakeImpactFX(Hit, Position, Normal, Material, ParentToPart, HitEffectData, BulletHoleData, ClientData)
	if Hit ~= nil and Position ~= nil and Normal ~= nil then
		local SurfaceCF = CFrame.new(Position, Position + Normal)

   		if HitEffectData[1] then
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = SurfaceCF
	    	Attachment.Parent = Workspace.Terrain
			local Sound

			local function Spawner(material)
				if HitEffectData[6][material.Name]:FindFirstChild("MaterialSounds") then
		            local tracks = HitEffectData[6][material.Name].MaterialSounds:GetChildren()
		            local rn = math.random(1, #tracks)
		            local track = tracks[rn]
		            if track ~= nil then
						Sound = track:Clone()
						if track:FindFirstChild("Pitch") then
							Sound.PlaybackSpeed = Random.new():NextNumber(track.Pitch.Min.Value, track.Pitch.Max.Value)
						else
							Sound.PlaybackSpeed = Random.new():NextNumber(HitEffectData[3], HitEffectData[4])
						end
						if track:FindFirstChild("Volume") then
							Sound.Volume = Random.new():NextNumber(track.Volume.Min.Value, track.Volume.Max.Value)
						else
							Sound.Volume = HitEffectData[5]
						end
						Sound.Parent = Attachment
		            end
				else
					Sound = Instance.new("Sound",Attachment)
					Sound.SoundId = "rbxassetid://"..HitEffectData[2][math.random(1, #HitEffectData[2])]
					Sound.PlaybackSpeed = Random.new():NextNumber(HitEffectData[3], HitEffectData[4])
					Sound.Volume = HitEffectData[5]
				end
				for i, v in pairs(HitEffectData[6][material.Name]:GetChildren()) do
					if v.ClassName == "ParticleEmitter" then
						local Count = 1
						local Particle = v:Clone()
						Particle.Parent = Attachment
						if Particle:FindFirstChild("EmitCount") then
							Count = Particle.EmitCount.Value
						end
						if Particle.PartColor.Value then
							local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
							if Hit and Hit:IsA("Terrain") then
								HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
							end
							Particle.Color = ColorSequence.new(HitPartColor, HitPartColor)
						end
						Thread:Delay(0.01, function()
							if OptimalEffects then
								local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
								if QualityLevel == Enum.SavedQualitySetting.Automatic then
									local Compressor = 1 / 2
									Particle:Emit(Count * Compressor)
								else
									local Compressor = QualityLevel.Value / 21
									Particle:Emit(Count * Compressor)
								end
							else
								Particle:Emit(Count)
							end
							Debris:AddItem(Particle, Particle.Lifetime.Max)
						end)
					end
				end
	        	Sound:Play()
			    if BulletHoleData[1] then
					local Hole = Instance.new("Attachment")
					Hole.Parent = ParentToPart and Hit or Workspace.Terrain
					Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
					if ParentToPart then
						local Scale = BulletHoleData[2]
						if HitEffectData[6][material.Name]:FindFirstChild("MaterialHoleSize") then
							Scale = HitEffectData[6][material.Name].MaterialHoleSize.Value
						end
						local A0 = Instance.new("Attachment")
						local A1 = Instance.new("Attachment")
						local BeamClone = Beam:Clone()
						BeamClone.Width0 = Scale
						BeamClone.Width1 = Scale
						if HitEffectData[6][material.Name]:FindFirstChild("MaterialDecals") then
				            local Decals = HitEffectData[6][material.Name].MaterialDecals:GetChildren()
							local Chosen = math.random(1, #Decals)
							local Decal = Decals[Chosen]
							if Decal ~= nil then
								BeamClone.Texture = "rbxassetid://"..Decal.Value
								if Decal.PartColor.Value then
									local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
									if Hit and Hit:IsA("Terrain") then
										HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
									end
									BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
								end
				            end
						else
							BeamClone.Texture = "rbxassetid://"..BulletHoleData[3][math.random(1, #BulletHoleData[3])]
						    if BulletHoleData[4] then
								local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
								if Hit and Hit:IsA("Terrain") then
									HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
								end
								BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
							end
						end
						BeamClone.Attachment0 = A0
						BeamClone.Attachment1 = A1
						A0.Parent = Hit
						A1.Parent = Hit
						A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
						A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
						BeamClone.Parent = Workspace.Terrain
						Thread:Delay(BulletHoleData[5], function()
							if BulletHoleData[5] > 0 then
								if OptimalEffects then
									if ClientData then
										local t0 = os.clock()
										while Hole ~= nil do
											local Alpha = math.min((os.clock() - t0) / BulletHoleData[6], 1)
											if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
										    if Alpha == 1 then break end
									      	Thread:Wait()
										end
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									else
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									end
								else
									local t0 = os.clock()
									while Hole ~= nil do
										local Alpha = math.min((os.clock() - t0) / BulletHoleData[6], 1)
										if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
									    if Alpha == 1 then break end
									    Thread:Wait()
									end
									if A0 then A0:Destroy() end
									if A1 then A1:Destroy() end
									if BeamClone then BeamClone:Destroy() end
									if Hole then Hole:Destroy() end
								end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
						    end
						end)
					else
						Debris:AddItem(Hole, 5)
					end
			    end
			end

			if not HitEffectData[7] then
				if HitEffectData[6]:FindFirstChild(Hit.Material) then
					Spawner(Hit.Material)
				else
					Spawner(HitEffectData[6].Custom)
				end
        	else
				Spawner(HitEffectData[6].Custom)
        	end

			Debris:AddItem(Attachment, 10)
		end
	end
end

local function MakeBloodFX(Hit, Position, Normal, Material, ParentToPart, BloodEffectData, ClientData)
	if Hit ~= nil and Position ~= nil and Normal ~= nil then
		local SurfaceCF = CFrame.new(Position, Position + Normal)

	    if BloodEffectData[1] then
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = SurfaceCF
			Attachment.Parent = Workspace.Terrain

			local Sound = Instance.new("Sound",Attachment)
			Sound.SoundId = "rbxassetid://"..BloodEffectData[2][math.random(1, #BloodEffectData[2])]
			Sound.PlaybackSpeed = Random.new():NextNumber(BloodEffectData[3], BloodEffectData[4])
			Sound.Volume = BloodEffectData[5]

			local function Spawner()
				local C = BloodEffectData[6]:GetChildren()
				for i, v in pairs(BloodEffectData[6]:GetChildren()) do
					if v.ClassName == "ParticleEmitter" then
						local Count = 1
						local Particle = C[i]:Clone()
						Particle.Parent = Attachment
						if Particle:FindFirstChild("EmitCount") then
							Count = Particle.EmitCount.Value
						end
						Thread:Delay(0.01, function()
							if OptimalEffects then
								local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
								if QualityLevel == Enum.SavedQualitySetting.Automatic then
									local Compressor = 1 / 2
									Particle:Emit(Count * Compressor)
								else
									local Compressor = QualityLevel.Value / 21
									Particle:Emit(Count * Compressor)
								end
							else
								Particle:Emit(Count)
							end
							Debris:AddItem(Particle, Particle.Lifetime.Max)
						end)
					end
				end
		        Sound:Play()
			end

			Thread:Spawn(Spawner)
		    Debris:AddItem(Attachment, 10)
		end

		if BloodEffectData[7][1] then
			local Hole = Instance.new("Attachment")
			Hole.Parent = ParentToPart and Hit or Workspace.Terrain
			Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
			if ParentToPart then
				local Scale = BloodEffectData[7][2]
				local A0 = Instance.new("Attachment")
				local A1 = Instance.new("Attachment")
				local BeamClone = Beam:Clone()
				BeamClone.Width0 = Scale
				BeamClone.Width1 = Scale
				BeamClone.Texture = "rbxassetid://"..BloodEffectData[7][3][math.random(1, #BloodEffectData[7][3])]
				BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, BloodEffectData[7][4]), ColorSequenceKeypoint.new(1, BloodEffectData[7][4])})
				if BloodEffectData[7][7] then
					local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
					if Hit and Hit:IsA("Terrain") then
						HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
					end
					BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
				end
				BeamClone.Attachment0 = A0
				BeamClone.Attachment1 = A1
				A0.Parent = Hit
				A1.Parent = Hit
				A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
				A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
				BeamClone.Parent = Workspace.Terrain
				Thread:Delay(BloodEffectData[7][5], function()
					if BloodEffectData[7][5] > 0 then
						if OptimalEffects then
							if ClientData then
								local t0 = os.clock()
								while Hole ~= nil do
									local Alpha = math.min((os.clock() - t0) / BloodEffectData[7][6], 1)
									if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
								    if Alpha == 1 then break end
							      	Thread:Wait()
								end
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
							end
						else
							local t0 = os.clock()
							while Hole ~= nil do
								local Alpha = math.min((os.clock() - t0) / BloodEffectData[7][6], 1)
								if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
							    if Alpha == 1 then break end
							    Thread:Wait()
							end
							if A0 then A0:Destroy() end
							if A1 then A1:Destroy() end
							if BeamClone then BeamClone:Destroy() end
							if Hole then Hole:Destroy() end
						end
					else
						if A0 then A0:Destroy() end
						if A1 then A1:Destroy() end
						if BeamClone then BeamClone:Destroy() end
					    if Hole then Hole:Destroy() end
				    end
				end)
			else
				Debris:AddItem(Hole, 5)
			end
		end
	end
end

local function OnRayHit(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, cosmeticBulletObject, hitData)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	cosmeticBulletObject.Transparency = 1
	for i, v in pairs(cosmeticBulletObject:GetDescendants()) do
		if (v:IsA("BasePart") or v:IsA("Decal") or v:IsA("Texture")) then
			v.Transparency = 1
		elseif v:IsA("ParticleEmitter") then
			v.Enabled = false
		elseif v:IsA("Sound") then
			v:Stop()
		elseif v:IsA("PointLight") then
			v.Enabled = false
		--[[elseif v:IsA("Trail") then -- There is a case that trail is barely visible when projectile hits (especially at high speed). So I marked it as comment.
			v.Enabled = false]]
		elseif v:IsA("Beam") then
			v.Enabled = false
		end
	end
	Debris:AddItem(cosmeticBulletObject, 5) -- 10
	if not hitData[1][1] then
	    if hitPart ~= nil and hitPart.Parent ~= nil then
			if hitData[6] ~= nil and hitPart.Name == "_glass" then
				ShatterGlass:FireServer(hitPart, hitPoint, direction)
			else
				local Distance = (hitPoint - origin).Magnitude
				local Target = hitPart:FindFirstAncestorOfClass("Model")
				local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
				local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
				local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
				if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
					if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
					if hitData[6] ~= nil then
						if TargetHumanoid.Health > 0 then
							Thread:Spawn(function()
								InflictTarget:InvokeServer(hitData[7], hitData[5],
			                    	Tagger,
			                       	TargetHumanoid,
					                TargetTorso,
									{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3],Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
					                {hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
					                {hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
					                hitPart,
					                {hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
							end)
							if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
								hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
							end
						end
					end
		   		else
					if ShowEffects then
						MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6])
					end
		   		end
			end
		end
    else
	    if hitData[1][3] then
			local Attachment = Instance.new("Attachment")
			Attachment.CFrame = CFrame.new(hitPoint)
			Attachment.Parent = Workspace.Terrain
			local Sound = Instance.new("Sound")
		    Sound.SoundId = "rbxassetid://"..hitData[1][4][math.random(1, #hitData[1][4])]
		    Sound.PlaybackSpeed = Random.new():NextNumber(hitData[1][5], hitData[1][6])
		    Sound.Volume = hitData[1][7]
		    Sound.Parent = Attachment
		    Sound:Play()
			Debris:AddItem(Attachment, 10)
		end

		local Explosion = Instance.new("Explosion")
		Explosion.BlastRadius = hitData[1][2]
		Explosion.BlastPressure = 0
		Explosion.ExplosionType = Enum.ExplosionType.NoCraters
	    Explosion.Position = hitPoint ~= nil and hitPoint or cosmeticBulletObject.Position
		Explosion.Parent = Camera

		local SurfaceCF = hitPart ~= nil and hitPoint ~= nil and normal ~= nil and CFrame.new(hitPoint, hitPoint + normal) or cosmeticBulletObject.CFrame

		if ShowEffects and hitPart ~= nil and hitPoint ~= nil and normal ~= nil then
			if hitData[1][11] then
				local Target = hitPart:FindFirstAncestorOfClass("Model")
				if hitPart and not hitPart.Parent or not (Target and Target:FindFirstChildOfClass("Humanoid")) then
					local ParentToPart = true
					local Hole = Instance.new("Attachment")
					Hole.Parent = ParentToPart and hitPart or Workspace.Terrain
					Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
					if ParentToPart then
						local Scale = hitData[1][12]
						local A0 = Instance.new("Attachment")
						local A1 = Instance.new("Attachment")
						local BeamClone = Beam:Clone()
						BeamClone.Width0 = Scale
						BeamClone.Width1 = Scale
						BeamClone.Texture = "rbxassetid://"..hitData[1][13][math.random(1, #hitData[1][13])]
				    	if hitData[1][14] then
							local HitPartColor = hitPart and hitPart.Color or Color3.fromRGB(255, 255, 255)
							if hitPart and hitPart:IsA("Terrain") then
								HitPartColor = Workspace.Terrain:GetMaterialColor(material or Enum.Material.Sand)
							end
							BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
						end
						BeamClone.Attachment0 = A0
						BeamClone.Attachment1 = A1
						A0.Parent = hitPart
						A1.Parent = hitPart
						A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
						A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
						BeamClone.Parent = workspace.Terrain
						Thread:Delay(hitData[1][15], function()
							if hitData[1][15] > 0 then
								if OptimalEffects then
									if hitData[6] then
										local t0 = os.clock()
										while Hole ~= nil do
											local Alpha = math.min((os.clock() - t0) / hitData[1][16], 1)
											if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
										    if Alpha == 1 then break end
									      	Thread:Wait()
										end
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									else
										if A0 then A0:Destroy() end
										if A1 then A1:Destroy() end
										if BeamClone then BeamClone:Destroy() end
									    if Hole then Hole:Destroy() end
									end
								else
									local t0 = os.clock()
									while Hole ~= nil do
										local Alpha = math.min((os.clock() - t0) / hitData[1][16], 1)
										if BeamClone then BeamClone.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
									    if Alpha == 1 then break end
									    Thread:Wait()
									end
									if A0 then A0:Destroy() end
									if A1 then A1:Destroy() end
									if BeamClone then BeamClone:Destroy() end
									if Hole then Hole:Destroy() end
								end
							else
								if A0 then A0:Destroy() end
								if A1 then A1:Destroy() end
								if BeamClone then BeamClone:Destroy() end
							    if Hole then Hole:Destroy() end
						    end
						end)
					else
						Debris:AddItem(Hole, 5)
					end
				end
			end
		end

		if hitData[1][8] then
			Explosion.Visible = false

			if ShowEffects then
			    local Attachment = Instance.new("Attachment")
			    Attachment.CFrame = SurfaceCF
		        Attachment.Parent = Workspace.Terrain

				local function Spawner()
					for i, v in pairs(hitData[1][9]:GetChildren()) do
						if v.ClassName == "ParticleEmitter" then
							local Count = 1
							local Particle = v:Clone()
							Particle.Parent = Attachment
							if Particle:FindFirstChild("EmitCount") then
								Count = Particle.EmitCount.Value
							end
							Thread:Delay(0.01, function()
								if OptimalEffects then
									local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
									if QualityLevel == Enum.SavedQualitySetting.Automatic then
										local Compressor = 1 / 2
										Particle:Emit(Count * Compressor)
									else
										local Compressor = QualityLevel.Value / 21
										Particle:Emit(Count * Compressor)
									end
								else
									Particle:Emit(Count)
								end
								Debris:AddItem(Particle, Particle.Lifetime.Max)
							end)
						end
					end
			    end

				Thread:Spawn(Spawner)
		        Debris:AddItem(Attachment, 10)
			end
		end

		local HitHumanoids = {}

		Explosion.Hit:Connect(function(HitPart, HitDist)
			if HitPart and hitData[6] ~= nil then
				if HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
					local Distance = (hitPoint - origin).Magnitude
					local Target = HitPart:FindFirstAncestorOfClass("Model")
					local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
					local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
					local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
					if TargetHumanoid then
						if TargetHumanoid.Health > 0 then
							if not HitHumanoids[TargetHumanoid] then
								if hitData[1][17] then
									local Multipler = hitData[1][20]
									local DistanceFactor = HitDist / hitData[1][2]
									DistanceFactor = 1 - DistanceFactor
									local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * hitData[1][18] --* DistanceFactor
									local AirVelocity = TargetTorso.Velocity - Vector3.new(0, TargetTorso.Velocity.y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z)
									if DamageModule.CanDamage(Target, hitData[5].Parent, hitData[6][1][7]) then
										local TorsoFly = Instance.new("BodyVelocity")
										TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
										TorsoFly.Velocity = AirVelocity
										TorsoFly.Parent = TargetTorso
										TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
										Debris:AddItem(TorsoFly, 0.25)
									else
										if TargetHumanoid.Parent.Name == Tagger.Name then
											Multipler = hitData[1][19]
											local TorsoFly = Instance.new("BodyVelocity")
											TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
											TorsoFly.Velocity = AirVelocity
											TorsoFly.Parent = TargetTorso
											TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
											Debris:AddItem(TorsoFly, 0.25)
										end
									end
								end
								Thread:Spawn(function()
									InflictTarget:InvokeServer(hitData[7], hitData[5],
										Tagger,
										TargetHumanoid,
										TargetTorso,
										{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
										{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
										{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
										HitPart,
										{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]},
										{hitData[1][1], hitData[1][2], HitDist, hitData[1][10], hitData[1][21], hitData[1][22], hitData[1][23]})
								end)
								if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
									hitData[5].GunScript_Local.MarkerEvent:Fire(HitPart.Name == "Head" and hitData[6][1][3])
								end
								HitHumanoids[TargetHumanoid] = true
							end
						end
					end
				elseif HitPart.Name == "_glass" then
					ShatterGlass:FireServer(HitPart, HitPart.Position, direction)
		    	end
			end
	    end)
	end
end

local function CanRayPenetrate(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, hitData)
	-- This function shows off the penetrating feature. Pass this function as the last argument (after bulletAcceleration) and it will run this every time the ray runs into an object
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart ~= nil and hitPart.Parent ~= nil then
		if hitData[6] ~= nil and hitPart.Name == "_glass" then
			ShatterGlass:FireServer(hitPart, hitPoint, direction)
			return "penetratedObject" -- Penetrate Object
		else
			local Distance = (hitPoint - origin).Magnitude
			local Target = hitPart:FindFirstAncestorOfClass("Model")
			local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
			local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
			local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
			if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
				if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
				if hitData[6] ~= nil then
					if TargetHumanoid.Health > 0 then
						Thread:Spawn(function()
							InflictTarget:InvokeServer(hitData[7], hitData[5],
		                    	Tagger,
		                      	TargetHumanoid,
				               	TargetTorso,
								{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
				               	{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
				               	{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
				               	hitPart,
				               	{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
						end)
						if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
							hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
						end
					end
				end
				return "penetratedHumanoid" -- Penetrate Humanoid
		  	else
		   		if ShowEffects then MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6]) end
				return "penetratedObject" -- Penetrate Object
		   	end
		end
	end
end

local function CanRayPenetrateHumanoid(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, penetrationAmount, hitData)
	-- This function shows off the penetrating feature. Pass this function as the last argument (after bulletAcceleration) and it will run this every time the ray runs into an object
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart ~= nil and hitPart.Parent ~= nil then
		if (hitPart.Transparency > 0.75
			or hitPart.Name == "Handle"
			or hitPart.Name == "Effect"
			or hitPart.Name == "Bullet"
			or hitPart.Name == "Laser"
			or string.lower(hitPart.Name) == "water"
			or hitPart.Name == "Rail"
			or hitPart.Name == "Arrow"
			or (hitPart.Parent:FindFirstChild("Humanoid") and hitPart.Parent.Humanoid.Health == 0)) then
			return true -- Penetrate Blacklisted Object
		else
			local Distance = (hitPoint - origin).Magnitude
			local Target = hitPart:FindFirstAncestorOfClass("Model")
			local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
			local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
			local Tagger = Players:GetPlayerFromCharacter(hitData[5].Parent)
			if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
				if penetrationAmount > 0 then
					if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
					if hitData[6] ~= nil then
						if TargetHumanoid.Health > 0 then
							Thread:Spawn(function()
								InflictTarget:InvokeServer(hitData[7], hitData[5],
			                   		Tagger,
			                  		TargetHumanoid,
				                	TargetTorso,
									{hitData[6][1][1], hitData[6][1][2], hitData[6][1][3], Distance, hitData[6][1][4], hitData[6][1][5], hitData[6][1][6], hitData[6][1][7]},
				                	{hitData[6][2][1], hitData[6][2][2], hitData[6][2][3], hitData[6][2][4], hitData[6][2][5]},
				                	{hitData[6][3][1], hitData[6][3][2], hitData[6][3][3]},
				                	hitPart,
				                	{hitData[6][4][1], hitData[6][4][2], hitData[6][4][3], hitData[6][4][4], hitData[6][4][5], hitData[6][4][6], hitData[6][4][7]})
							end)
							if hitData[5].GunScript_Local:FindFirstChild("MarkerEvent") then
								hitData[5].GunScript_Local.MarkerEvent:Fire(hitPart.Name == "Head" and hitData[6][1][3])
							end
						end
					end
				end
				return true -- Penetrate Humanoid
			--[[else
				-- We must check if penetrationAmount reachs 0
				if penetrationAmount <= 0 then
			   		MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6])
				end]]
			end
		end
	end
	return false -- Can't penetrate
end

local function OnRayExited(origin, direction, hitPart, hitPoint, normal, material, segmentVelocity, hitData)
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(hitPoint, ScreenCullingRadius) and (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance) or (hitPoint - Camera.CFrame.p).Magnitude <= RenderDistance
	if hitPart.Name == "_glass" then
		return
	else
		local Target = hitPart:FindFirstAncestorOfClass("Model")
		local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
		local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
		if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
			if ShowEffects then MakeBloodFX(hitPart, hitPoint, normal, material, true, hitData[4], hitData[6]) end
		else
		   	if ShowEffects then MakeImpactFX(hitPart, hitPoint, normal, material, true, hitData[2], hitData[3], hitData[6]) end
		end
	end
end

local function OnRayUpdated(castOrigin, segmentOrigin, segmentDirection, length, segmentVelocity, cosmeticBulletObject, bulletData, whizData, hitData)
	-- Whenever the caster steps forward by one unit, this function is called
	-- The bullet argument is the same object passed into the fire function
	local bulletLength = cosmeticBulletObject.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
	local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
	if bulletData[1] then
		cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength)) * CFrame.Angles(math.rad(-360 * (os.clock() * bulletData[2] - math.floor(os.clock() * bulletData[2]))), math.rad(-360 * (os.clock() * bulletData[3] - math.floor(os.clock() * bulletData[3]))), math.rad(-360 * (os.clock() * bulletData[4] - math.floor(os.clock() * bulletData[4]))))
	else
		cosmeticBulletObject.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
	end
	if hitData[6] == nil and whizData[1] and cosmeticBulletObject.Parent and cosmeticBulletObject:FindFirstChild("Whizzed") then
		local Whizzed = cosmeticBulletObject:FindFirstChild("Whizzed")
		if not Whizzed.Value then
	   		local Mag = (Camera.CFrame.p - cosmeticBulletObject.Position).Magnitude
			if Mag < whizData[5] then
				--local Loudness = 1 - (mag / whizData[5])
				local WhizSound = Instance.new("Sound")
				WhizSound.SoundId = "rbxassetid://"..whizData[2][math.random(1, #whizData[2])]
				WhizSound.Volume = whizData[6] --Loudness
				WhizSound.PlaybackSpeed = Random.new():NextNumber(whizData[3], whizData[4])
				WhizSound.Name = "WhizSound"
				WhizSound.Parent = SoundService
				WhizSound:Play()
				Debris:AddItem(WhizSound, WhizSound.TimeLength / WhizSound.PlaybackSpeed)
				Whizzed.Value = true
			end
		end
	end
end

function ProjectileHandler:VisualizeHitEffect(Type, Replicate, Hit, Position, Normal, Material, ...)
	if Replicate then
		VisualizeHitEffect:FireServer(Type, nil, Hit, Position, Normal, Material, ...)
	end
	local ShowEffects = ScreenCullingEnabled and (ScreenCulling(Position, ScreenCullingRadius) and (Position - Camera.CFrame.p).Magnitude <= RenderDistance) or (Position - Camera.CFrame.p).Magnitude <= RenderDistance
	if ShowEffects then
		if Type == "Normal" then
			MakeImpactFX(Hit, Position, Normal, Material, ...)
		elseif Type == "Blood" then
			MakeBloodFX(Hit, Position, Normal, Material, ...)
		end
	end
end

function ProjectileHandler:SimulateProjectile(Module, Tool, Handle, Directions, FirePointObject, HitEffectData, BloodEffectData, BulletHoleData, ExplosiveData, BulletData, WhizData, ClientData)
	if Module and Tool and Handle then
		if ClientData ~= nil then
			VisualizeBullet:FireServer(Module, Tool, Handle, Directions, FirePointObject, HitEffectData, BloodEffectData, BulletHoleData, ExplosiveData, BulletData, WhizData, nil)
		end
		for _, Direction in pairs(Directions) do
			local Origin, Dir = FirePointObject.WorldPosition, Direction

            if FirePointObject ~= nil then
                local TipCFrame = FirePointObject.WorldCFrame
				local TipPos = TipCFrame.Position
				local TipDir = TipCFrame.LookVector
				local AmountToCheatBack = math.abs((Tool.Parent:FindFirstChild("HumanoidRootPart").Position - TipPos):Dot(TipDir)) + 1
				local gunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
                local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(gunRay, {Handle, Tool.Parent, Camera}, false, true)
				if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
					Origin = HitPoint - TipDir.Unit * 0.1
                    --Dir = TipDir.Unit
                end
            end

			local HumanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart", 1)
			local MyMovementSpeed = HumanoidRootPart.Velocity
			local ModifiedBulletSpeed = (Dir * BulletData[2]) -- + MyMovementSpeed

			local Bullet = Projectiles[BulletData[1]]:Clone()
			Bullet.CFrame = CFrame.new(Origin, Origin + Dir)
			Bullet.Parent = Camera

			local Whizzed = Instance.new("BoolValue")
			Whizzed.Name = "Whizzed"
			Whizzed.Value = false
			Whizzed.Parent = Bullet

			for _, v in pairs(Bullet:GetDescendants()) do
				if v:IsA("ParticleEmitter") then
					v.Enabled = true
				elseif v:IsA("Sound") then
					v:Play()
				elseif v:IsA("PointLight") then
					v.Enabled = true
				elseif v:IsA("Trail") then
					v.Enabled = true
				elseif v:IsA("Beam") then
					v.Enabled = true
				end
			end

			if ClientData ~= nil then
				if (BulletData[10] > 0 or BulletData[11] > 0) and not ExplosiveData[1] then
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool,
						{{ClientData[1][1], ClientData[1][2], ClientData[1][3], ClientData[1][4], ClientData[1][5], ClientData[1][6], ClientData[1][7]},
	                	{ClientData[2][1], ClientData[2][2], ClientData[2][3], ClientData[2][4], ClientData[2][5], ClientData[2][6], ClientData[2][7], ClientData[2][8]},
	                	{ClientData[3][1], ClientData[3][2], ClientData[3][3]},
	                	{ClientData[4][1], ClientData[4][2], ClientData[4][3], ClientData[4][4], ClientData[4][5], ClientData[4][6], ClientData[4][7]}},
						Module},
						{penetrationType = BulletData[5], penetrationDepth = BulletData[10], canPenetrateFunction = CanRayPenetrate, penetrationAmount = BulletData[11], canPenetrateHumanoidFunction = CanRayPenetrateHumanoid})
				else
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool,
						{{ClientData[1][1], ClientData[1][2], ClientData[1][3], ClientData[1][4], ClientData[1][5], ClientData[1][6], ClientData[1][7]},
	                	{ClientData[2][1], ClientData[2][2], ClientData[2][3], ClientData[2][4], ClientData[2][5], ClientData[2][6], ClientData[2][7], ClientData[2][8]},
	                	{ClientData[3][1], ClientData[3][2], ClientData[3][3]},
	                	{ClientData[4][1], ClientData[4][2], ClientData[4][3], ClientData[4][4], ClientData[4][5], ClientData[4][6], ClientData[4][7]}},
						Module},
						nil)
				end
			else
				if (BulletData[10] > 0 or BulletData[11] > 0) and not ExplosiveData[1] then
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool, nil, Module},
						{penetrationType = BulletData[5], penetrationDepth = BulletData[10], canPenetrateFunction = CanRayPenetrate, penetrationAmount = BulletData[11], canPenetrateHumanoidFunction = CanRayPenetrateHumanoid})
				else
					Caster:FireWithBlacklist(Origin, Dir * BulletData[4], ModifiedBulletSpeed, {Handle, Tool.Parent, Camera}, Bullet, true, BulletData[3], {BulletData[6], BulletData[7], BulletData[8], BulletData[9]}, WhizData,
						{{ExplosiveData[1], ExplosiveData[2], ExplosiveData[3], ExplosiveData[4], ExplosiveData[5], ExplosiveData[6], ExplosiveData[7], ExplosiveData[8], ExplosiveData[9], ExplosiveData[10], ExplosiveData[11], ExplosiveData[12], ExplosiveData[13], ExplosiveData[14], ExplosiveData[15], ExplosiveData[16], ExplosiveData[17], ExplosiveData[18], ExplosiveData[19], ExplosiveData[20], ExplosiveData[21], ExplosiveData[22], ExplosiveData[23]},
	                	{HitEffectData[1], HitEffectData[2], HitEffectData[3], HitEffectData[4], HitEffectData[5], HitEffectData[6], HitEffectData[7], HitEffectData[8]},
	                	{BulletHoleData[1], BulletHoleData[2], BulletHoleData[3], BulletHoleData[4], BulletHoleData[5], BulletHoleData[6]},
	                	{BloodEffectData[1], BloodEffectData[2], BloodEffectData[3], BloodEffectData[4], BloodEffectData[5], BloodEffectData[6], BloodEffectData[7]},
						Tool, nil, Module},
						nil)
				end
			end
		end
	end
end

Caster.LengthChanged:Connect(OnRayUpdated)
Caster.RayHit:Connect(OnRayHit)
Caster.RayExited:Connect(OnRayExited)

return ProjectileHandler


Prompt: -- Roblox services

Response:
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")

local npcModel = script.Parent


Prompt: --DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!

Response:
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Slingshot


Prompt: --		if Plr.Backpack:FindFirstChild("Reactor Startup Key") then

Response:
			key=true
			keyset:Fire()


Prompt:
--[=[
	Returns whether or not a value is an observable.
	@param item any
	@return boolean
]=]

Response:
function Observable.isObservable(item)
	return type(item) == "table" and item.ClassName == "Observable"
end


Prompt: -- Mimic the enabling of the topbar when StarterGui:SetCore("TopbarEnabled", state) is called

Response:
coroutine.wrap(function()
	local chatScript = players.LocalPlayer.PlayerScripts:WaitForChild("ChatScript", 4) or game:GetService("Chat"):WaitForChild("ChatScript", 4)
	if not chatScript then return end
	local chatMain = chatScript:FindFirstChild("ChatMain")
	if not chatMain then return end
	local ChatMain = require(chatMain)
	ChatMain.CoreGuiEnabled:connect(function()
		local topbarEnabled = checkTopbarEnabled()
		if topbarEnabled == IconController.previousTopbarEnabled then
			IconController.updateTopbar()
			return "SetCoreGuiEnabled was called instead of SetCore"
		end
		IconController.previousTopbarEnabled = topbarEnabled
		if IconController.controllerModeEnabled then
			IconController.setTopbarEnabled(false,false)
		else
			IconController.setTopbarEnabled(topbarEnabled,false)
		end
		IconController.updateTopbar()
	end)
	IconController.setTopbarEnabled(checkTopbarEnabled(),false)
end)()