Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	(Yields) Animates the camera after activating the surface art prompt.

	Target position: Center of the SurfaceGui that we want to animate to (in studs)

	Parameters:
	- surfaceGui (SurfaceGui): mounted SurfaceGui instance
]]


function CameraModule:animateToCanvasAsync(surfaceGui)
	self.camera.CameraType = Enum.CameraType.Scriptable

	-- Store this so we can reset to this position later on
	self.initialCFrame = self.camera.CFrame
	self.surfaceGui = surfaceGui

	local adornee = self.surfaceGui.Adornee
	local face = self.surfaceGui.Face
	local canvasPosition = adornee.Position

	-- Look into the middle of SurfaceGui from a distance
	local offset = adornee.CFrame:VectorToWorldSpace(Vector3.FromNormalId(face))

	-- Compute offset distance dynamically to make sure entire canvas is in field of view
	local function getDistanceToCanvas(fov, size)
		local angle = math.rad(fov / 2)
		local opp = (size + CANVAS_OFFSET_PADDING) / 2

		return opp / math.tan(angle)
	end

	local aspectRatio = self.camera.ViewportSize.X / self.camera.ViewportSize.Y
	local vertical = getDistanceToCanvas(self.camera.FieldOfView, surfaceGui.adornee.Size.Y)
	local horizontal = getDistanceToCanvas(self.camera.FieldOfView * aspectRatio, surfaceGui.adornee.Size.X)

	local distance = math.max(horizontal, vertical)
	distance = math.clamp(distance, MIN_STUDS_OFFSET, MAX_STUDS_OFFSET)
	offset *= distance

	local upVector = self:_getUpVectorByFace(adornee.CFrame, face)
	local target = CFrame.lookAt(canvasPosition + offset, canvasPosition, upVector)

	-- Top view has a weird bug that turns things upside down
	if face == Enum.NormalId.Top then
		target *= CFrame.Angles(0, 0, math.pi)
	end

	self:_tweenCamera(target)
end
--[=[
	@class ClientRemoteProperty
	@client
	Created via `ClientComm:GetProperty()`.
]=]


local ClientRemoteProperty = {}
ClientRemoteProperty.__index = ClientRemoteProperty

function ClientRemoteProperty.new(
	re: RemoteEvent,
	inboundMiddleware: Types.ClientMiddleware?,
	outboudMiddleware: Types.ClientMiddleware?
)
	local self = setmetatable({}, ClientRemoteProperty)
	self._rs = ClientRemoteSignal.new(re, inboundMiddleware, outboudMiddleware)
	self._ready = false
	self._value = nil
	self.Changed = Signal.new()
	self._readyPromise = self:OnReady():andThen(function()
		self._readyPromise = nil
		self.Changed:Fire(self._value)
		self._changed = self._rs:Connect(function(value)
			if value == self._value then
				return
			end
			self._value = value
			self.Changed:Fire(value)
		end)
	end)
	self._rs:Fire()
	return self
end
--[[
	Given a `tweenInfo` and `currentTime`, returns a ratio which can be used to
	tween between two values over time.
]]



local TweenService = game:GetService("TweenService")

local function getTweenRatio(tweenInfo: TweenInfo, currentTime: number): number
	local delay = tweenInfo.DelayTime
	local duration = tweenInfo.Time
	local reverses = tweenInfo.Reverses
	local numRepeats = tweenInfo.RepeatCount
	local easeStyle = tweenInfo.EasingStyle
	local easeDirection = tweenInfo.EasingDirection

	local cycleDuration = delay + duration
	if reverses then
		cycleDuration += duration
	end

	if currentTime >= cycleDuration * math.max(numRepeats, 1) then
		return 1
	end

	local cycleTime = currentTime % cycleDuration

	if cycleTime <= delay then
		return 0
	end

	local tweenProgress = (cycleTime - delay) / duration
	if tweenProgress > 1 then
		tweenProgress = 2 - tweenProgress
	end

	local ratio = TweenService:GetValue(tweenProgress, easeStyle, easeDirection)
	return ratio
end

return getTweenRatio
---------------------------------------------------------------------------------------------------------------------------
-- Functions
---------------------------------------------------------------------------------------------------------------------------



local function Weld(X, Y)
	local CJ = CFrame.new(X.Position)
	local C0 = X.CFrame:inverse()*CJ
	local C1 = Y.CFrame:inverse()*CJ
	
	local W = Create("Weld"){
		Name = "Weld",
		Parent = X,
		Part0 = X,
		Part1 = Y,
		C0 = C0,
		C1 = C1
	}
end

local function WeldObjects(parent)
	for i, obj in pairs(parent:GetChildren()) do
		if obj:IsA("BasePart") then
			Weld(Handle, obj)
			obj.Anchored = false
			-- print("[Weld] Objects have been welded!")
		end
	end
end

Tool.Equipped:connect(function()
	WeldObjects(Tool)
end)

Tool.Unequipped:connect(function()
	WeldObjects(Tool)
end)
-- Customization


	AntiTK = false; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
	
	MouseSense = 0.5;

	CanAim = true; -- Allows player to aim
	CanBolt = true; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
	
	LaserAttached = true;
	LightAttached = true;
	TracerEnabled = true;
	
	SprintSpeed = 20;
	
	CanCallout = false;
	SuppressCalloutChance = 0;
--[[Drivetrain]]

	
	Tune.Config			= "AWD"		--"FWD" , "RWD" , "AWD"
	
	--Differential Settings	
	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	= 50		-- 1 - 100%
	Tune.RDiffLockThres	= 50		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
	
	--Traction Control Settings
	Tune.TCSEnabled		= true		-- Implements TCS
	Tune.TCSThreshold	= 0.5		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 0.5		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 50		-- Minimum amount of torque at max reduction (in percent)
-- @ModuleDescription Library containing other small function useful for programming.


local System = require(game.ReplicatedStorage.System) :: any
local Module = {}
Module.Replicated = true

local HTTPService = game:GetService("HttpService")

function Module.Rotate(t)
	local output = {{}, {}, {}}

	for i, row in pairs(t) do
		for j = 1,3 do
			output[j][4-i] = row[j]
		end
	end

	return output
end

function Module.Compare(arr1, arr2) : boolean
	local a1 = HTTPService:JSONEncode(arr1)
	local a2 = HTTPService:JSONEncode(arr2)
	return a1 == a2
end

return Module
-- Gets a part from the cache, or creates one if no more are available.


function PartCacheStatic:GetPart(): BasePart
	assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("GetPart", "PartCache.new"))

	if #self.Open == 0 then
		warn("No parts available in the cache! Creating [" .. self.ExpansionSize .. "] new part instance(s) - this amount can be edited by changing the ExpansionSize property of the PartCache instance... (This cache now contains a grand total of " .. tostring(#self.Open + #self.InUse + self.ExpansionSize) .. " parts.)")
		for i = 1, self.ExpansionSize, 1 do
			table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
		end
	end
	local part = self.Open[#self.Open]
	self.Open[#self.Open] = nil
	table.insert(self.InUse, part)

	for _, v in ipairs(self.Trails) do
		part[v].Enabled = true
	end

	return part
end
---


while true do
	if sys.Code.Value == true and folder.KV.Value.Value == config.AllCode.Value or
		folder.KV.Value.Value == config.Codes.F1.Value or
		folder.KV.Value.Value == config.Codes.F2.Value or
		folder.KV.Value.Value == config.Codes.F3.Value or
		folder.KV.Value.Value == config.Codes.F4.Value or
		folder.KV.Value.Value == config.Codes.F5.Value or
		folder.KV.Value.Value == config.Codes.F6.Value or
		folder.KV.Value.Value == config.Codes.F7.Value or
		folder.KV.Value.Value == config.Codes.F8.Value or
		folder.KV.Value.Value == config.Codes.F9.Value or
		folder.KV.Value.Value == config.Codes.F10.Value
then
wait(0.25)
		---
		folder.Display.Value = folder.KV
		folder.CodePrivate.Value = ""
		huh.Parent.Display.SurfaceGui.TextLabel.TextTransparency = 0
		---
		open()
		wait(1)
		sys.Code.Value = false
	end
	wait()
end
--[=[
	Short hand to register a propertyEvent changing

	```lua
	Blend.mount(workspace, {
		[Blend.OnChange "Name"] = function(name)
			print(name)
		end;
	}) --> Immediately will print "Workspace"

	workspace.Name = "Hello" --> Prints "Hello"
	```

	@param propertyName string
	@return (instance: Instance) -> Observable
]=]


function Blend.OnChange(propertyName)
	assert(type(propertyName) == "string", "Bad propertyName")

	return function(instance)
		return RxInstanceUtils.observeProperty(instance, propertyName)
	end
end
--PLACEMENT BEHAVIORS
-- INFO
--- In all cases, a single star is placed at the
---  exact center.  This is used for the Center
---  and Cluster Connect behaviors.
-- FUNCTIONS
--- createPart()
----- Creates a new star part with the specified
-----  parameters in the cfg.  Uses weighted
-----  random selection for the size range and
-----  color, and TrueRandom for the size within
-----  the size range.
-- BEHAVIORS
--- BLOCK
----- Gets the size of the Part and halves it,
-----  then uses TrueRandom in Libs.Random to get
-----  a refined number between the negative part
-----  size dimension and the positive part size
-----  dimension.
--- SPHERE
----- Gets the smallest dimension of the Part
-----  and then uses that as the radius as the 
-----  dimensions of a cube.  Using TrueRandom in
-----  Libs.Random, a point is chosen inside the
-----  bounds of the cube.  That point is then
-----  tested against the radius; if the distance
-----  from the center of the Part to the chosen
-----  point is greater than the radius, the point
-----  is rejected.  The process repeats until a
-----  valid point is found.
--- CYLINDER
----- Essentially the same as Sphere, however the
-----  point chosen uses the smallest axis for the
-----  random X/Z values and the actual Y axis for
-----  the random Y value.  The point is then
-----  tested against only the X/Z axis.
-- Game controller joystick detection


UserInputService.InputChanged:connect(function(Key)
	if Key.KeyCode == Enum.KeyCode.Thumbstick1 then
		local SteerPos = Key.Position.X*0.9
		
		-- Start steering
		if Steer ~= SteerPos and Key.Position.X ~= 0 then
			Steer = SteerPos
		end
		-- Ends steering
		if Key.Position.X > -0.3 and Key.Position.X < 0.3 then
			Steer = 0
		end
	end
end)
--[=[
	Janitor is a light-weight, flexible object for cleaning up connections, instances, or anything. This implementation covers all use cases,
	as it doesn't force you to rely on naive typechecking to guess how an instance should be cleaned up.
	Instead, the developer may specify any behavior for any object.

	@class Janitor
]=]


local Janitor = {}
Janitor.ClassName = "Janitor"
Janitor.CurrentlyCleaning = true
Janitor[IndicesReference] = nil
Janitor.__index = Janitor

local TypeDefaults = {
	["function"] = true;
	RBXScriptConnection = "Disconnect";
}
-- Initialize the tool


local NewPartTool = {
	Name = 'New Part Tool';
	Color = BrickColor.new 'Really black';

	-- Default options
	Type = 'Normal';

	-- Signals
	OnTypeChanged = Signal.new();
}

NewPartTool.ManualText = [[<font face="GothamBlack" size="16">New Part Tool  🛠</font>
Lets you create new parts.<font size="6"><br /></font>

<b>TIP:</b> Click and drag where you want your part to be.]]
--[[**
	ensures value matches string pattern

	@param string pattern to check against

	@returns A function that will return true iff the condition is passed
**--]]


function t.match(pattern)
	assert(t.string(pattern))
	return function(value)
		local stringSuccess = t.string(value)
		if not stringSuccess then
			return false
		end

		if string.match(value, pattern) == nil then
			return false
		end

		return true
	end
end
--


wait(1)
	powerlmp.Value = true

function Alert()
	script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Test()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end

	function Attack()
	script.AttackScript.Disabled = false
end


		function Cancel()
			script.Parent.Assembly.Sound.Click:Play()
		script.AttackScript.Disabled = true
		script.Parent.Values.Mode.Value = 4
		script.Parent.Parent.On.Value = false
		script.Parent.Values.TimerOn.Value = false
end


function Timer()
script.Timer.Disabled = false
signallmp.Value = true
end

		script.Parent.Values.TimerOn.Changed:connect(function()
	if script.Parent.Values.TimerOn.Value == true then
if script.Parent.Values.Mode.Value == 2 then
Alert()
Timer()
elseif script.Parent.Values.Mode.Value == 3 then
Attack()
Timer()
elseif script.Parent.Values.Mode.Value == 1 then
Test()
elseif script.Parent.Values.Mode.Value == 4 then
script.AttackScript.Disabled = true
Cancel()
				end
		end
end)


script.Parent.Values.Mode.Changed:connect(function()
if script.Parent.Values.Mode.Value == 4 then
Cancel()
end
end)
-- opcode types for getting values


local OPCODE_T = {
	[0] = 'ABC',
	'ABx',
	'ABC',
	'ABC',
	'ABC',
	'ABx',
	'ABC',
	'ABx',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'AsBx',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'ABC',
	'AsBx',
	'AsBx',
	'ABC',
	'ABC',
	'ABC',
	'ABx',
	'ABC',
}

local OPCODE_M = {
	[0] = {b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgK', c = 'OpArgN'},
	{b = 'OpArgU', c = 'OpArgU'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgU', c = 'OpArgN'},
	{b = 'OpArgK', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgN'},
	{b = 'OpArgU', c = 'OpArgN'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgU', c = 'OpArgU'},
	{b = 'OpArgR', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgR'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgK', c = 'OpArgK'},
	{b = 'OpArgR', c = 'OpArgU'},
	{b = 'OpArgR', c = 'OpArgU'},
	{b = 'OpArgU', c = 'OpArgU'},
	{b = 'OpArgU', c = 'OpArgU'},
	{b = 'OpArgU', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgR', c = 'OpArgN'},
	{b = 'OpArgN', c = 'OpArgU'},
	{b = 'OpArgU', c = 'OpArgU'},
	{b = 'OpArgN', c = 'OpArgN'},
	{b = 'OpArgU', c = 'OpArgN'},
	{b = 'OpArgU', c = 'OpArgN'},
}
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{41,30,56,58},t},
[49]={{41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{41,30,56,58,20,19},t},
[59]={{41,59},t},
[63]={{41,30,56,58,23,62,63},t},
[34]={{41,39,35,34},t},
[21]={{41,30,56,58,20,21},t},
[48]={{41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{41,39,35,34,32,31},t},
[56]={{41,30,56},t},
[29]={{41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{41,39,35,34,32,31,29,28,44,45},t},
[57]={{41,30,56,57},t},
[36]={{41,39,35,37,36},t},
[25]={{41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{41,59,61,71},t},
[20]={{41,30,56,58,20},t},
[60]={{41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{41,59,61,71,72,76,73,75},t},
[22]={{41,30,56,58,20,21,22},t},
[74]={{41,59,61,71,72,76,73,74},t},
[62]={{41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{41,39,35,37},t},
[2]={n,f},
[35]={{41,39,35},t},
[53]={{41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{41,59,61,71,72,76,73},t},
[72]={{41,59,61,71,72},t},
[33]={{41,39,35,37,36,33},t},
[69]={{41,60,69},t},
[65]={{41,30,56,58,20,19,66,64,65},t},
[26]={{41,39,35,34,32,31,29,28,27,26},t},
[68]={{41,30,56,58,20,19,66,64,67,68},t},
[76]={{41,59,61,71,72,76},t},
[50]={{41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{41,30,56,58,23},t},
[44]={{41,39,35,34,32,31,29,28,44},t},
[39]={{41,39},t},
[32]={{41,39,35,34,32},t},
[3]={n,f},
[30]={{41,30},t},
[51]={{41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{41,30,56,58,20,19,66,64,67},t},
[61]={{41,59,61},t},
[55]={{41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{41,39,40,38,42},t},
[40]={{41,39,40},t},
[52]={{41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{41},t},
[17]={n,f},
[38]={{41,39,40,38},t},
[28]={{41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{41,30,56,58,20,19,66,64},t},
}
return r
--If you want to add custom tabs, feel free to uncomment and edit. You may copy and paste.
--[[function CustomTab() 
	HideAllTabs()
	script.Parent.TABS.TabNameHere1.Visible = true
	script.Parent.SelectTab.TabButtonNameHere.Style = "RobloxButtonDefault"
	script.Parent.CurrentPage.Value = 1
	script.Parent.CurrentType.Value = "TabNameHere"
	script.Parent.Page.Text = script.Parent.CurrentPage.Value
end]]



function Next()
	if script.Parent.TABS:FindFirstChild(script.Parent.CurrentType.Value .. "Frame" .. (script.Parent.CurrentPage.Value + 1)) ~= nil then
		HideAllTabs()
		script.Parent.CurrentPage.Value = script.Parent.CurrentPage.Value + 1
		script.Parent.Page.Text = script.Parent.CurrentPage.Value
		script.Parent.TABS:FindFirstChild(script.Parent.CurrentType.Value .. "Frame" .. (script.Parent.CurrentPage.Value)).Visible = true
	else print("That page does not exist.")
	end	
end

function Prev()
	if script.Parent.TABS:FindFirstChild(script.Parent.CurrentType.Value .. "Frame" .. (script.Parent.CurrentPage.Value - 1)) ~= nil then
		HideAllTabs()
		script.Parent.CurrentPage.Value = script.Parent.CurrentPage.Value - 1
		script.Parent.Page.Text = script.Parent.CurrentPage.Value 
		script.Parent.TABS:FindFirstChild(script.Parent.CurrentType.Value .. "Frame" .. (script.Parent.CurrentPage.Value)).Visible = true
	else print("That page does not exist.")
	end	
end

script.Parent.SelectTab.Swords.MouseButton1Click:connect(Sword)
script.Parent.SelectTab.Staffs.MouseButton1Click:connect(Staff)
script.Parent.SelectTab.Ranged.MouseButton1Click:connect(Ranged)
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 3000		-- Front brake force
	Tune.RBrakeForce	= 2200		-- Rear brake force
	Tune.PBrakeForce	= 5000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--Automatic Settings


Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
Tune.AutoUpThresh	= -500		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 2400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= true					--Estimates top speed

local UNITS	= {								--Click on speed to change units
	--First unit is default	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 240				,
		spInc			= 20				, -- Increment between labelled notches
	},

	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 300				,
		spInc			= 60				, -- Increment between labelled notches
	}
}
--local function invitePromptClosed(senderPlayer, recipientIds)
--	-- Handle custom logic for players invited by sender
--	print(senderPlayer)
--	for k, v in pairs(recipientIds) do
--		print(k,v)
--	end
--	button.Visible = false
--end
--SocialService.GameInvitePromptClosed:Connect(invitePromptClosed)
-- A recursive function (google it) which traverses all parts in a model to weld them.


function WeldAll(instance, mainPart, list)
	if instance:IsA("BasePart") then
		table.insert(list, CreateWeld(mainPart, instance))
	end
	for _,v in pairs(instance:GetChildren()) do	
		WeldAll(v, mainPart, list)
	end	
end
--// bolekinds



local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	if plr.YouCash.Value >= 0 and game.ServerStorage.ServerData.Roommate.Value == false then
		script.Parent.Parent.Parent.Ching:Play()
		game.ServerStorage.ServerData.Roommate.Value = true
	end
end)
-- Used to keep players on the cart



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

local function charaterAdded(character)
	local forceField = Instance.new("ForceField")
	forceField.Visible = false
	local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
	humanoidRootPart.CanCollide = true
	forceField.Parent = character
	PhysicsService:SetPartCollisionGroup(humanoidRootPart, "Players")
end

local function playerAdded(player)
	player.CharacterAdded:Connect(charaterAdded)
end

Players.PlayerAdded:Connect(playerAdded)
-- BAR MANIPULATION --


local function CheckSet(N,S,D) -- Number, Scale, Direction
	local nS = Soundbar[tostring(N)].Size.Y.Scale
	if S>nS then
		Set(N,nS+(S-nS)/3,D)
	end
end

function Set(N,S,D) -- Number, Scale, Direction
	Quad(Soundbar[tostring(N)],S,'Out',.1) -- Grabs the bar and tweens
	if N>0 and D~=1 then -- Checks left for smaller bars to manipulate
		CheckSet(N-1,S,-1)
	end
	if N<nBars and D~=-1 then -- Checks right...
		CheckSet(N+1,S,1)
	end
end
--// F key, HornOff


mouse.KeyUp:connect(function(key)
	if key=="f" then 
		veh.Lightbar.middle.Airhorn:Stop()
		veh.Lightbar.middle.Wail.Volume = 10
		veh.Lightbar.middle.Yelp.Volume = 10
		veh.Lightbar.middle.Priority.Volume = 10
		veh.Lightbar.AH.Transparency = 1
	end
end)
-- Preload animations


function playAnimation(animName, transitionTime, humanoid) 

	local roll = math.random(1, animTable[animName].totalWeight) 
	local origRoll = roll
	local idx = 1
	while (roll > animTable[animName][idx].weight) do
		roll = roll - animTable[animName][idx].weight
		idx = idx + 1
	end
	--		print(animName .. " " .. idx .. " [" .. origRoll .. "]")
	local anim = animTable[animName][idx].anim

	-- switch animation		
	if (anim ~= currentAnimInstance) then

		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0

		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		currentAnimTrack.Priority = Enum.AnimationPriority.Core

		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)

	end

end
-- Variables


local DefaultTime = 5 -- Default is to delete over 5 seconds
local DefaultScenePosition = Vector3.new(0, 0, 0)

local function GiveObjectPrimaryPart(Obj)
	-- Setup the object inside a model, provide a PrimaryPart
	local Model = Instance.new("Model")
	Model.Parent = Obj.Parent
	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.CanCollide = false
	Part.Transparency = 1
	Part.Parent = Model
	Model.PrimaryPart = Part
	if Obj:IsA("Model") and Obj.PrimaryPart then
		Part.Position = Obj.PrimaryPart.Position
	else
		Part.Position = DefaultScenePosition
	end
	Obj.Parent = Model
	return Model
end

local function DeleteAmountOfObjectsInTable(Table, DeleteGoal)
	local JustDestroyed = 0
	for i = #Table, 1, -1 do
		local Object = Table[i]
		if Object and Object.Parent then
			Object:Destroy()
		end
		table.remove(Table, i)
		JustDestroyed += 1
		if #Table <= 0 then
			return true
		elseif JustDestroyed >= DeleteGoal then
			return false
		end
	end
end