Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[ Functions overridden from BaseCamera ]]

--
function LegacyCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
	return BaseCamera.SetCameraToSubjectDistance(self,desiredSubjectDistance)
end

function LegacyCamera:Update(dt: number): (CFrame, CFrame)

	-- Cannot update until cameraType has been set
	if not self.cameraType then return end

	local now = tick()
	local timeDelta = (now - self.lastUpdate)
	local camera = 	workspace.CurrentCamera
	local newCameraCFrame = camera.CFrame
	local newCameraFocus = camera.Focus
	local player = PlayersService.LocalPlayer

	if self.lastUpdate == nil or timeDelta > 1 then
		self.lastDistanceToSubject = nil
	end
	local subjectPosition: Vector3 = self:GetSubjectPosition()

	if self.cameraType == Enum.CameraType.Fixed then
		if subjectPosition and player and camera then
			local distanceToSubject = self:GetCameraToSubjectDistance()
			local newLookVector = self:CalculateNewLookVectorFromArg(nil, CameraInput.getRotation())

			newCameraFocus = camera.Focus -- Fixed camera does not change focus
			newCameraCFrame = CFrame.new(camera.CFrame.p, camera.CFrame.p + (distanceToSubject * newLookVector))
		end

	elseif self.cameraType == Enum.CameraType.Attach then
		local subjectCFrame = self:GetSubjectCFrame()
		local cameraPitch = camera.CFrame:ToEulerAnglesYXZ()
		local _, subjectYaw = subjectCFrame:ToEulerAnglesYXZ()
		
		cameraPitch = math.clamp(cameraPitch - CameraInput.getRotation().Y, -PITCH_LIMIT, PITCH_LIMIT)
		
		newCameraFocus = CFrame.new(subjectCFrame.p)*CFrame.fromEulerAnglesYXZ(cameraPitch, subjectYaw, 0)
		newCameraCFrame = newCameraFocus*CFrame.new(0, 0, self:StepZoom())

	elseif self.cameraType == Enum.CameraType.Watch then
		if subjectPosition and player and camera then
			local cameraLook = nil

			if subjectPosition == camera.CFrame.p then
				warn("Camera cannot watch subject in same position as itself")
				return camera.CFrame, camera.Focus
			end

			local humanoid = self:GetHumanoid()
			if humanoid and humanoid.RootPart then
				local diffVector = subjectPosition - camera.CFrame.p
				cameraLook = diffVector.unit

				if self.lastDistanceToSubject and self.lastDistanceToSubject == self:GetCameraToSubjectDistance() then
					-- Don't clobber the zoom if they zoomed the camera
					local newDistanceToSubject = diffVector.magnitude
					self:SetCameraToSubjectDistance(newDistanceToSubject)
				end
			end

			local distanceToSubject: number = self:GetCameraToSubjectDistance()
			local newLookVector: Vector3 = self:CalculateNewLookVectorFromArg(cameraLook, CameraInput.getRotation())

			newCameraFocus = CFrame.new(subjectPosition)
			newCameraCFrame = CFrame.new(subjectPosition - (distanceToSubject * newLookVector), subjectPosition)

			self.lastDistanceToSubject = distanceToSubject
		end
	else
		-- Unsupported type, return current values unchanged
		return camera.CFrame, camera.Focus
	end

	self.lastUpdate = now
	return newCameraCFrame, newCameraFocus
end

return LegacyCamera
------------------------------------------------------------------------------
--------------------[ MAIN PROGRAM ]------------------------------------------
------------------------------------------------------------------------------



function DetonateSmoke()
	local GrenadePos = Main.Position
	
	CreateShockwave(GrenadePos, S.GrenadeEffectRadius)
	
	Sound:Play()
	
	spawn(function()
		for i = 1, math.floor(S.GrenadeEffectRadius * 0.35) do
			local Size = RAND(S.GrenadeEffectRadius * 0.4, S.GrenadeEffectRadius * 0.5)
			local Dist = RAND(0, S.GrenadeEffectRadius - Size)
			local XRot, YRot = RAD(RAND(0, 180, 10)), RAD(RAND(0, 360, 10))
			local RotLV = (CFANG(0, YRot, 0) * CFANG(XRot, 0, 0)).lookVector
			local Pos = GrenadePos + (RotLV * VEC3(Dist, Dist / 2, Dist))
			
			local Smoke = Instance.new("Part")
			Smoke.Transparency = 1
			Smoke.Name = "Smoke"
			Smoke.Anchored = true
			Smoke.CanCollide = false
			Smoke.FormFactor = Enum.FormFactor.Symmetric
			Smoke.Size = VEC3(1, 1, 1)
			Smoke.TopSurface = Enum.SurfaceType.Smooth
			Smoke.BottomSurface = Enum.SurfaceType.Smooth
			
			local Mesh = Instance.new("SpecialMesh")
			Mesh.MeshType = Enum.MeshType.Sphere
			Mesh.Scale = VEC3(Size, Size, Size)
			Mesh.Parent = Smoke
			
			Smoke.Parent = Main.Parent
			Smoke.CFrame = CF(Pos)
			
			spawn(function()
				local Trans = RAND(0.3, 0.5, 0.01)
				for X = 0, 90, 5 do
					Smoke.CFrame = CF(GrenadePos:lerp(Pos, Sine(X)))
					Smoke.Transparency = NumLerp(1, Trans, Sine(X))
					wait()
				end
				
				wait(S.GrenadeEffectTime)
				
				for X = 0, 90, 1 do
					Smoke.CFrame = CF(Pos:lerp(Pos + VEC3(0, 20, 0), 1 - COS(RAD(X))))
					Smoke.Transparency = NumLerp(Trans, 1, Sine(X))
					wait()
				end
				
				Smoke:Destroy()
			end)
			
			wait()
		end
	end)
	
	Main.Transparency = 1
	Main.Anchored = true
	Main.CanCollide = false
	
	wait(S.GrenadeEffectTime + 4)
	Main:Destroy()
end

if S.TimerStartOnHit then
	local Detonated = false
	Main.Touched:connect(function(Obj)
		if IsIgnored(Obj) or Detonated then return end
		Main.Velocity = Main.Velocity / 4
		Detonated = true
		
		wait(S.DetonationTime)
		
		DetonateSmoke()
	end)
else
	spawn(function()
		local Touched = false
		Main.Touched:connect(function(Obj)
			if IsIgnored(Obj) or Touched then return end
			Touched = true
			Main.Velocity = Main.Velocity / 4
		end)
	end)
	wait(S.DetonationTime)
	DetonateSmoke()
end
-- ROBLOX deviation: MockFunctionResultType defined as string for now but
-- eventually should be = 'return' | 'throw' | 'incomplete';


type MockFunctionResultType = string
type MockFunctionResult = {
	type: MockFunctionResultType,
	value: any,
}
type MockFunctionConfig = {
	-- ROBLOX deviation: mockImpl defined as any for now but should be Function | nil if/when Luau supports general function type
	mockImpl: any,
	mockName: string,
	specificReturnValues: Array<any>,
	-- ROBLOX deviation: specificMockImpls defined as Array<any> for now but should be Array<Function> if/when Luau supports general function type
	specificMockImpls: Array<any>,
}

export type ModuleMocker = {
	isMockFunction: (_self: ModuleMocker, fn: any) -> boolean,
	fn: (_self: ModuleMocker, implementation: any) -> (),
	clearAllMocks: (_self: ModuleMocker) -> (),
	resetAllMocks: (_self: ModuleMocker) -> (),
	restoreAllMocks: (_self: ModuleMocker) -> (),
	mocked: <T>(_self: ModuleMocker, item: T, _deep: boolean?) -> MaybeMocked<T> | MaybeMockedDeep<T>,
}

ModuleMockerClass.__index = ModuleMockerClass
function ModuleMockerClass.new()
	local self = {
		_mockState = {},
		_mockConfigRegistry = {},
		_invocationCallCounter = 1,
		_spyState = Set.new(),
	}

	setmetatable(self, ModuleMockerClass)

	return self
end
------------------------------------------------------------
--\Doors Update
------------------------------------------------------------


local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local CAS = game:GetService("ContextActionService")

local mDistance = 5
local Key = nil

function getNearest()
	local nearest = nil
	local minDistance = mDistance
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	for I,Door in pairs (DoorsFolder:GetChildren()) do
		if Door.Door:FindFirstChild("Knob") ~= nil then
			local distance = (Door.Door.Knob.Position - Character.Torso.Position).magnitude
		
			if distance < minDistance then
				nearest = Door
				minDistance = distance
			end
		end
	end
	--print(nearest)
	return nearest
end

function Interact(actionName, inputState, inputObj)
	if inputState ~= Enum.UserInputState.Begin then return end
	
	local nearestDoor = getNearest()
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	if nearestDoor == nil then return end
	
	if (nearestDoor.Door.Knob.Position - Character.Torso.Position).magnitude <= mDistance then
		if nearestDoor ~= nil then
			if nearestDoor:FindFirstChild("RequiresKey") then
				Key = nearestDoor.RequiresKey.Value
			else
				Key = nil
			end
			Evt.DoorEvent:FireServer(nearestDoor,1,Key)
		end
	end
end


function GetNearest(parts, maxDistance,Part)
	local closestPart
	local minDistance = maxDistance
    for _, partToFace in ipairs(parts) do
        local distance = (Part.Position - partToFace.Position).magnitude
        if distance < minDistance then
            closestPart = partToFace
            minDistance = distance
        end
   end
	return closestPart
end

CAS:BindAction("Interact", Interact, false, Enum.KeyCode.G)
--[[Transmission]]


	Tune.TransModes		= {"Auto", "Semi"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)

	--Gear Ratios
	Tune.FinalDrive		= 3.1
	Tune.Ratios			= {
		--[[Reverse]]	4.29			,
		--[[Neutral]]	0			,
		--[[ 1 ]]		4.71			,
		--[[ 2 ]]		3.14		,
		--[[ 3 ]]		2.10		,
		--[[ 4 ]]		1.67		,
		--[[ 5 ]]		1.29		,
		--[[ 6 ]]		1.00			,
		--[[ 7 ]]		0.84			,
	}
	Tune.FDMult			= 1.00			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
------------------------------------------------------------------------------------------------------------------------------
--// Other declerations



local IMGFRAME = instance("ImageLabel");
IMGFRAME.Size = udim2(0, 0, 0, 0);
IMGFRAME.BackgroundTransparency = 1;
IMGFRAME.ScaleType = Enum.ScaleType.Stretch;

local REPLACE = string.byte("?");

local justify1 = {
	["Right"] = true;
	["Bottom"] = true
};

local justify0 = {
	["Left"] = true;
	["Top"] = true
};

local redraws = {
	["AbsoluteSize"] = true;
	["TextWrapped"] = true;
	["TextScaled"] = true;
	["TextXAlignment"] = true;
	["TextYAlignment"] = true;
};

local overwrites = {
	["TextTransparency"] = true;
	["TextStrokeTransparency"] = true;
	["BackgroundTransparency"] = true;
};

local noReplicate = {
	["AbsolutePosition"] = true;
	["AbsoluteSize"] = true;
	["Position"] = true;
	["Size"] = true;
	["Rotation"] = true;
	["Parent"] = true;
};

local customProperties = {
	["FontName"] = true;
	["Style"] = true;
};
--// Aim|Zoom|Sensitivity Customization


	ZoomSpeed = 0.23; -- The lower the number the slower and smoother the tween
	AimZoom = 30; -- Default zoom
	AimSpeed = 0.23;
	UnaimSpeed = 0.23;
	CycleAimZoom = 55; -- Cycled zoom
	MouseSensitivity = 0.5; -- Number between 0.1 and 1
	SensitivityIncrement = 0.05; -- No touchy
--==================================================



local function Enabler(plyr)
	if Enabled then
		local AmmoRefilled = false
		local Player = plyr
		if Player then
			for _, GunName in pairs(GunToRefillAmmo) do
				local Gun = Player.Backpack:FindFirstChild(GunName) or Player.Character:FindFirstChild(GunName)
				if Gun then
					local GunScript = Gun:FindFirstChild("GunScript_Server")
					local Module = Gun:FindFirstChild("Setting")
					if GunScript and Module then
						local Module = require(Module)
						if GunScript.Ammo.Value < Module.MaxAmmo and Module.LimitedAmmoEnabled then
							if Cooldown ~= 0 then
								Enabled = false
								AmmoBox.Main.Sound:Play()
								local function delayer()
									Enabled = true
								end
								delay(Cooldown, delayer)
							else
								AmmoBox.Main.Sound:Play()
							end
							AmmoRefilled = true
							local ChangedAmmo = (Ammo == math.huge or GunScript.Ammo.Value + Ammo >= Module.Ammo) and Module.MaxAmmo or (GunScript.Ammo.Value + Ammo)
							GunScript.Ammo.Value = ChangedAmmo
							GunScript.ChangeMagAndAmmo:FireClient(Player,Module.AmmoPerMag,ChangedAmmo,0)
						end
					end
				end
			end
		end
	end
end
AmmoBox.ClickDetector.MouseClick:Connect(Enabler)
--[[Drivetrain]]

	
	Tune.Config			= "RWD"		-- "FWD" , "RWD" , "AWD"
	Tune.TorqueVector	= .4		-- AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
	
	-- Differential Settings
	Tune.DifferentialType = 'New'	-- New: Fairly precise and accurate settings based on a real differential
									-- Old: Same differential as previous iterations of AC6
	
	-- Old Options
	Tune.FDiffSlipThres	= 50		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 50		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 80		-- 1 - 100%
	Tune.RDiffLockThres	= 20		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
	
	-- New Options (LuaInt)
	Tune.FDiffPower		= 30		-- 0 - 100				Higher values yield more wheel lock-up under throttle, more stability (Front wheels if driven only)
	Tune.FDiffCoast		= 10		-- 0 - 100				Higher values yield more wheel lock-up when off throttle, more stability (Front wheels if driven only)
	Tune.FDiffPreload	= 10		-- 0 - 100				Higher values will make the wheels generally lock up faster in any environment (Front wheels if driven only)
	Tune.RDiffPower		= 40		-- 0 - 100				(Rear wheels if driven only)
	Tune.RDiffCoast		= 20		-- 0 - 100				(Rear wheels if driven only)
	Tune.RDiffPreload	= 20		-- 0 - 100				(Rear wheels if driven only)
	
	-- Traction Control Settings
	Tune.TCSEnabled		= true		-- Implements TCS
	Tune.TCSThreshold	= 20		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 20		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 10		-- Minimum amount of torque at max reduction (in percent)
-- Custom Services


local database = require(game:GetService("ServerScriptService").Database.DatabaseHandler)

local function OnCharacterAdded(character)
	
	--Setup variables
	local statsFolder = Instance.new("Folder")
	statsFolder.Name = "Stats"
	
	local safeZoneBool = Instance.new("IntValue")
	safeZoneBool.Name = "isSafe"
	safeZoneBool.Parent = statsFolder
	
	statsFolder.Parent = character
end

players.PlayerAdded:Connect(function(player)
	local playerID = player.UserId
	
	
	local playerProfile = database.GetProfile(playerID)
	if not playerProfile or playerProfile == 0 then
		database.CreateProfile(playerID)
	else
		-- Perform this check in case someone adds new properties to the data template
		database.UpdateProfileTemplate(playerID)
	end
	
	player.CharacterAdded:Connect(OnCharacterAdded)
	player:LoadCharacter()
end)
	
players.PlayerRemoving:Connect(function(player) 
	local playerID = player.UserId
	database.SaveProfile(playerID)
end)
--[[ SCRIPT VARIABLES ]]


local CHAT_BUBBLE_FONT = Enum.Font.Antique
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_PADDING = 12
local CHAT_BUBBLE_FADE_SPEED = 1.5

local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250	--This limits the number of bubble chats that you see above characters

local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - getMessageLength(ELIPSES) - 1

local NEAR_BUBBLE_DISTANCE = 65	--previously 45
local MAX_BUBBLE_DISTANCE = 100	--previously 80
-- Mimic roblox menu when opened and closed


guiService.MenuClosed:Connect(function()
	menuOpen = false
	if not IconController.controllerModeEnabled then
		IconController.setTopbarEnabled(IconController.topbarEnabled, false)
	end
end)
guiService.MenuOpened:Connect(function()
	menuOpen = true
	IconController.setTopbarEnabled(false, false)
end)
--// Recoil Settings	


	gunrecoil = -0.6; -- How much the gun recoils backwards when not aiming
	camrecoil = 0.46; -- How much the camera flicks when not aiming
	AimGunRecoil = -0.3; -- How much the gun recoils backwards when aiming
	AimCamRecoil = 0.43; -- How much the camera flicks when aiming
	
	CamShake = 1; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
	AimCamShake = 1; -- THIS IS ALSO NEW!!!!
	
	Kickback = 0.0; -- Upward gun rotation when not aiming
	AimKickback = 0.0; -- Upward gun rotation when aiming
-- [ SETTINGS ] --



local statsName = "Cash" -- Your stats name
local maxItems = 100 -- Max number of items to be displayed on the leaderboard
local minValueDisplay = 1 -- Any numbers lower than this will be excluded
local maxValueDisplay = 10e15 -- (10 ^ 15) Any numbers higher than this will be excluded
local abbreviateValue = true -- The displayed number gets abbreviated to make it "human readable"
local updateEvery = 60 -- (in seconds) How often the leaderboard has to update
local headingColor = Color3.fromRGB(20, 102, 254) -- The background color of the heading
--This is the server sided module for handling this vehicles seating requests


local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local HttpService = game:GetService("HttpService")

local DOOR_OPEN_SPEED = 2.15
local DOOR_OPEN_ANGLE = 55
local DOOR_OPEN_TIME = 0.5 --How long the door stays open for when entering/leaving

local MAX_SEATING_DISTANCE = 15
local MIN_FLIP_ANGLE = 70 --degrees from vertical

local PackagedScripts = script.Parent
local PackagedVehicle = PackagedScripts.Parent
local VehicleConfig = PackagedVehicle:WaitForChild("Configuration", 10)
if not VehicleConfig then
	warn("No vehicle configuration present, will use default values")
end

local AllowCarjacking = false
local AllowCarjackingConfig = VehicleConfig:WaitForChild("AllowCarjacking", 10)
if not AllowCarjackingConfig then
	warn("No AllowCarjacking configuration present, will use default value of false")
else
	AllowCarjacking = AllowCarjackingConfig.Value
end


local RemotesFolder = nil --Set later in the code by the SetRemotesFolder function
--// All global vars will be wiped/replaced except script



return function(data, env)
	if env then
		setfenv(1, env)
	end

	local gui = client.UI.Prepare(script.Parent.Parent)
	local frame = gui.Frame
	local frame2 = frame.Frame
	local msg = frame2.Message
	local ttl = frame2.Title

	local gIndex = data.gIndex
	local gTable = data.gTable

	local title = data.Title
	local message = data.Message
	local scroll = data.Scroll
	local tim = data.Time

	if not data.Message or not data.Title then gTable:Destroy() end

	ttl.Text = title
	msg.Text = message

	local function fadeOut()
		for i = 1,12 do
			msg.TextTransparency = msg.TextTransparency+0.05
			ttl.TextTransparency = ttl.TextTransparency+0.05
			msg.TextStrokeTransparency = msg.TextStrokeTransparency+0.05
			ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+0.05
			frame2.BackgroundTransparency = frame2.BackgroundTransparency+0.05
			service.Wait("Stepped")
		end
		service.UnWrap(gui):Destroy()
	end

	gTable.CustomDestroy = function()
		fadeOut()
	end

	task.spawn(function()
		local sound = Instance.new("Sound",service.LocalContainer())
		sound.SoundId = "rbxassetid://7152561753"
		sound.Volume = 0.3
		task.wait(0.1)
		sound:Play()
		task.wait(1)
		sound:Destroy()
	end)

	gTable.Ready()

	frame:TweenSize(UDim2.new(0, 350, 0, 150), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.2)

	if not tim then
		local _,time = message:gsub(" ","")
		time = math.clamp(time/2,4,11)+1
		task.wait(time)
	else
		task.wait(tim)
	end

	fadeOut()
end
-- 3D TextGen



This = script.Parent
Btn = This.Parent
Characters = require(script.Characters)

function ChangeFloor(SF)
	if string.len(SF) == 1 then
		SetLabel(1,SF,-0.03)	
		SetLabel(2,"NIL",0)
	else
		SetLabel(1,SF:sub(1,1),0)	
		SetLabel(2,SF:sub(2,2),0)
	end
end


function SetLabel(ID,CHAR,OFFSET)
	if This:FindFirstChild("L"..ID) and Characters[CHAR] ~= nil then
		This["L"..ID].Mesh.Offset = Vector3.new(OFFSET, -0.004, 0)
		for i,l in pairs(Characters[CHAR]) do 
			This["L"..ID].Mesh.MeshId = "rbxassetid://"..l
		end
	end
end


ChangeFloor(Btn.Name)

script:Destroy()
------------------------------------------------



local function EnterFreecam()
	ToggleGui(false)
	UIS.MouseIconEnabled = false
	Maid:Mark(UIS.InputBegan:Connect(function(input, processed)
		if input.UserInputType == Enum.UserInputType.MouseButton2 then
			UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
			local conn = UIS.InputChanged:Connect(Panned)
			repeat
				input = UIS.InputEnded:wait()
			until input.UserInputType == Enum.UserInputType.MouseButton2 or not freeCamEnabled
			panDeltaMouse = Vector2.new()
			panDeltaGamepad = Vector2.new()
			conn:Disconnect()
			if freeCamEnabled then
				UIS.MouseBehavior = Enum.MouseBehavior.Default
			end
		elseif input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
			SpeedModifier = 0.5
		end
	end))

	Maid:Mark(UIS.InputEnded:Connect(function(input, processed)
		if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
			SpeedModifier = 1
		end
	end))

	camera.CameraType = Enum.CameraType.Scriptable

	local hum, hrp = GetChar()
	if hrp then
		hrp.Anchored = true
	end
	if hum then
		hum.WalkSpeed = 0
		Maid:Mark(hum.Jumping:Connect(function(active)
			if active then
				hum.Jumping = false
			end
		end))
	end

	velSpring.t, velSpring.v, velSpring.x = Vector3.new(), Vector3.new(), Vector3.new()
	rotSpring.t, rotSpring.v, rotSpring.x = Vector2.new(), Vector2.new(), Vector2.new()
	fovSpring.t, fovSpring.v, fovSpring.x = camera.FieldOfView, 0, camera.FieldOfView

	local camCFrame = camera.CFrame
	local lookVector = camCFrame.lookVector.unit

	stateRot = Vector2.new(
		math.asin(lookVector.y),
		math.atan2(-lookVector.z, lookVector.x) - math.pi/2
	)
	panDeltaMouse = Vector2.new()

	local playerGui = player:WaitForChild("PlayerGui")
	for _, obj in next, playerGui:GetChildren() do
		if obj:IsA("ScreenGui") and obj.Enabled then
			obj.Enabled = false
			screenGuis[obj] = true
		end
	end
	if LETTERBOX then
		letterbox.Enabled = true
	end
	RS:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, UpdateFreecam)
	freeCamEnabled = true
end

local function ExitFreecam()
	freeCamEnabled = false
	if LETTERBOX then
		letterbox.Enabled = false
	end
	UIS.MouseIconEnabled = true
	UIS.MouseBehavior = Enum.MouseBehavior.Default
	Maid:Sweep()
	RS:UnbindFromRenderStep("Freecam")
	local hum, hrp = GetChar()
	if hum then
		hum.WalkSpeed = 16
	end
	if hrp then
		hrp.Anchored = false
	end
	camera.FieldOfView = DEF_FOV
	camera.CameraType = Enum.CameraType.Custom
	for obj in next, screenGuis do
		obj.Enabled = true
	end
	screenGuis = {}
	ToggleGui(true)
end
-- Remote Functions Client -> Server


	-- Getters
		RF_getPlayerData.OnServerInvoke = function(player)
			local cahced = database.GetCachedProfile(player.UserId) 
			return cahced
		end
		RF_vehicleSpawnRequest.OnServerInvoke = function(player) return vehicles.SpawnPlayerVehicle(player, 1) end
		RF_vehicleRemoveRequest.OnServerInvoke = function(player) return vehicles.RemovePlayerVehicle(player) end
		RF_redeemCode.OnServerInvoke = function(player, code) return twitter.RedeemCode(player, code)  end
		
		-- Weapons
		RF_GetUnlockedWeapons.OnServerInvoke = function(player) return weapons.GetUnlockedWeapons(player)  end
		RF_GetWeaponInfo.OnServerInvoke = function(player, weaponID) return weapons.GetWeaponInfo(player, weaponID) end
		RF_GetEquipedWeapon.OnServerInvoke = function(player) return weapons.GetEquipedWeapon(player) end
		
		RF_EquipWeapon.OnServerInvoke = function(player,weaponID) return weapons.EquipWeapon(player, weaponID) end
		RF_UnEquipWeapon.OnServerInvoke = function(player) return weapons.UnEquipWeapon(player) end
		RF_BuyWeapon.OnServerInvoke = function(player, weaponID) return weapons.BuyWeapon(player, weaponID) end