Prompt: --// All global vars will be wiped/replaced except script

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

	--local client = service.GarbleTable(client)
	local Player = service.Players.LocalPlayer
	local Mouse = Player:GetMouse()
	local InputService = service.UserInputService
	local gIndex = data.gIndex
	local gTable = data.gTable

	local Event = gTable.BindEvent
	local GUI = gTable.Object
	local Name = data.Name
	local Icon = data.Icon
	local Size = data.Size
	local Menu = data.Menu
	local Title = data.Title
	local Ready = data.Ready
	local Walls = data.Walls
	local noHide = data.NoHide
	local noClose = data.NoClose
	local onReady = data.OnReady
	local onClose = data.OnClose
	local onResize = data.OnResize
	local onRefresh = data.OnRefresh
	local onMinimize = data.OnMinimize
	local ContextMenu = data.ContextMenu
	local ResetOnSpawn = data.ResetOnSpawn
	local CanKeepAlive = data.CanKeepAlive
	local iconClicked = data.IconClicked
	local SizeLocked = data.SizeLocked or data.SizeLock
	local CanvasSize = data.CanvasSize
	local Position = data.Position
	local Content = data.Content or data.Children
	local MinSize = data.MinSize or {150, 50}
	local MaxSize = data.MaxSize or {math.huge, math.huge}
	local curIcon = Mouse.Icon
	local isClosed = false
	local Resizing = false
	local Refreshing = false
	local DragEnabled = true
	local checkProperty = service.CheckProperty
	local specialInsts = {}
	local inExpandable
	local addTitleButton
	local LoadChildren
	local BringToFront
	local functionify

	local Drag = GUI.Drag
	local Close = Drag.Close
	local Hide = Drag.Hide
	local Iconf = Drag.Icon
	local Titlef = Drag.Title
	local Refresh = Drag.Refresh
	local rSpinner = Refresh.Spinner
	local Main = Drag.Main
	local Tooltip = GUI.Desc
	local ScrollFrame = GUI.Drag.Main.ScrollingFrame
	local LeftSizeIcon = Main.LeftResizeIcon
	local RightSizeIcon = Main.RightResizeIcon
	local RightCorner = Main.RightCorner
	local LeftCorner = Main.LeftCorner
	local RightSide = Main.RightSide
	local LeftSide = Main.LeftSide
	local TopRight = Main.TopRight
	local TopLeft = Main.TopLeft
	local Bottom = Main.Bottom
	local Top = Main.Top

	local function RippleEffect(element)
		spawn(function()
			element.ClipsDescendants = true
			local effect = create("ImageLabel", {
				Parent = element,
				AnchorPoint = Vector2.new(0.5, 0.5),
				BorderSizePixel = 0,
				ZIndex = element.ZIndex + 1,
				BackgroundTransparency = 0.5,
				ImageTransparency = 0.8,
				Image = "rbxasset://textures/whiteCircle.png",
				Position = UDim2.new(0.5, 0, 0.5, 0),
			})
			effect:TweenSize(UDim2.new(0, element.AbsoluteSize.X * 2.5, 0, element.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2)
			wait(0.2)
			effect:Destroy()
		end)
	end

	local clickSound = service.New("Sound")
	clickSound.Parent = GUI.Drag
	clickSound.Volume = 0.4
	clickSound.SoundId = "rbxassetid://6706935653"

	Main.DescendantAdded:Connect(function(child)
		if child:IsA("TextButton") and not child:FindFirstChildOfClass("UIGradient") then
			local gradient = Instance.new("UIGradient", child)
			gradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,Color3.new(1,1,1)),ColorSequenceKeypoint.new(1,Color3.fromRGB(80,80,80))}
			--[[create("ImageLabel", {
				BackgroundTransparency = 1;
				ImageTransparency = 0.5;
				Image = "rbxassetid://456420746";  -- For dusty Aero :]
				Size = UDim2.new(1, 0, 1, 0);
				Parent = child;
				ZIndex = 2
			})]]
		end
	end)

	function Expand(ent, point, text)
		local label = point:FindFirstChild("Label")

		if label then
			ent.MouseLeave:Connect(function(x,y)
				if inExpandable == ent then
					point.Visible = false
				end
			end)

			ent.MouseMoved:Connect(function(x,y)
				inExpandable = ent
				label.Text = text or ent.Desc.Value
				--point.Size = UDim2.new(0, 10000, 0, 10000)
				local newx = 500
				local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
				local rows = math.floor(bounds/500)
				rows = rows+1
				if rows<1 then rows = 1 end
				if bounds<500 then newx = bounds end
				point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
				point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
				point.Visible = true
			end)
		end
	end

	function getNextPos(frame)
		local farXChild, farYChild
		for i,v in next,frame:GetChildren() do
			if checkProperty(v, "Size") then
				if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
					farXChild = v
				end

				if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
					farYChild = v
				end
			end
		end

		return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
	end

	function LoadChildren(Obj, Children)
		if Children then
			local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
			for class,data in next,Children do
				if type(data) == "table" then
					if not data.Parent then data.Parent = Obj end
					create(data.Class or data.ClassName or class, data)
				elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
					runWhenDone = functionify(data, Obj)
				end
			end

			if runWhenDone then
				runWhenDone(Obj)
			end
		end
	end

	function BringToFront()
		for i,v in ipairs(Player.PlayerGui:GetChildren()) do
			if v:FindFirstChild("__ADONIS_WINDOW") then
				v.DisplayOrder = 100
			end
		end

		GUI.DisplayOrder = 101
	end

	function addTitleButton(data)
		local startPos = 1
		local realPos
		local new
		local original = Hide

		if Hide.Visible then
			startPos = startPos+1
		end

		if Close.Visible then
			startPos = startPos+1
		end

		if Refresh.Visible then
			startPos = startPos+1
		end

		realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 3)
		data.Position = data.Position or realPos
		data.Size = data.Size or original.Size
		data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
		data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
		data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
		data.ZIndex = data.ZIndex or original.ZIndex
		data.TextColor3 = data.TextColor3 or original.TextColor3
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
		data.TextSize = data.TextSize or original.TextSize
		data.TextTransparency = data.TextTransparency or original.TextTransparency
		data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextWrapped = data.TextWrapped or original.TextWrapped
		--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
		--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
		data.Font = data.Font or original.Font
		data.Parent = Drag

		local newTitleButton = create("TextButton", data)
		create("UICorner", {CornerRadius = UDim.new(0,4);Parent = newTitleButton})

		newTitleButton.MouseButton1Down:Connect(function() RippleEffect(newTitleButton) end)
		return newTitleButton
	end

	function functionify(func, object)
		if type(func) == "string" then
			if object then
				local env = GetEnv()
				env.Object = object
				return client.Core.LoadCode(func, env)
			else
				return client.Core.LoadCode(func)
			end
		else
			return func
		end
	end

	function create(class, dataFound, existing)
		local data = dataFound or {}
		local class = data.Class or data.ClassName or class
		local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
		local parent = data.Parent or new.Parent

		if dataFound then
			data.Parent = nil

			if data.Class or data.ClassName then
				data.Class = nil
				data.ClassName = nil
			end

			if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
				new.BorderColor3 = dBorder
			end

			if not data.CanvasSize and checkProperty(new,"CanvasSize") then
				new.CanvasSize = dCanvasSize
			end

			if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
				new.BorderSizePixel = dPixelSize
			end

			if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
				new.BackgroundColor3 = dBackground
			end

			if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
				new.PlaceholderColor3 = dPlaceholderColor
			end

			if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
				new.BackgroundTransparency = dTransparency
			elseif data.Transparency then
				new.BackgroundTransparency = data.Transparency
			end

			if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
				new.TextColor3 = dTextColor
			elseif data.TextColor then
				new.TextColor3 = data.TextColor
			end

			if not data.Font and checkProperty(new, "Font") then
				data.Font = dFont
			end

			if not data.TextSize and checkProperty(new, "TextSize") then
				data.TextSize = dTextSize
			end

			if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
				new.BottomImage = dScrollImage
				new.MidImage = dScrollImage
				new.TopImage = dScrollImage
			end

			if not data.Size and checkProperty(new,"Size") then
				new.Size = dSize
			end

			if not data.Position and checkProperty(new,"Position") then
				new.Position = dPosition
			end

			if not data.ZIndex and checkProperty(new,"ZIndex") then
				new.ZIndex = dZIndex
				if parent and checkProperty(parent, "ZIndex") then
					new.ZIndex = parent.ZIndex
				end
			end

			if data.TextChanged and class == "TextBox" then
				local textChanged = functionify(data.TextChanged, new)
				new.FocusLost:Connect(function(enterPressed)
					textChanged(new.Text, enterPressed, new)
				end)
			end

			if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") then
				local debounce = false;
				local doDebounce = data.Debounce;
				local onClick = functionify((data.OnClicked or data.OnClick), new)
				new.MouseButton1Down:Connect(function()
					if not debounce then
						if doDebounce then
							debounce = true
						end

						RippleEffect(new)
						onClick(new);

						debounce = false;
					end
				end)
			end

			if data.Events then
				for event,func in pairs(data.Events) do
					local realFunc = functionify(func, new)
					Event(new[event], function(...)
						realFunc(...)
					end)
				end
			end

			if data.Visible == nil then
				data.Visible = true
			end

			if data.LabelProps then
				data.LabelProperties = data.LabelProps
			end
		end

		if class == "Entry" then
			local label = new.Text
			local dots = new.Dots
			local desc = new.Desc

			label.ZIndex = data.ZIndex or new.ZIndex
			dots.ZIndex = data.ZIndex or new.ZIndex

			if data.Text then
				new.Text.Text = data.Text
				new.Text.Visible = true
				data.Text = nil
			end

			if data.Desc or data.ToolTip then
				new.Desc.Value = data.Desc or data.ToolTip
				data.Desc = nil
			end

			Expand(new, Tooltip)
		else
			if data.ToolTip then
				Expand(new, Tooltip, data.ToolTip)
			end
		end

		if class == "ButtonEntry" then
			local button = new.Button
			local debounce = false
			local onClicked = functionify(data.OnClicked, button)

			new:SetSpecial("DoClick",function()
				if not debounce then
					debounce = true
					if onClicked then
						onClicked(button)
					end
					debounce = false
				end
			end)

			new.Text = data.Text or new.Text
			button.ZIndex = data.ZIndex or new.ZIndex
			button.MouseButton1Down:Connect(function()
				clickSound:Play()
				RippleEffect(new)
				new.DoClick()
			end)
		end

		if class == "Boolean" then
			local enabled = data.Enabled
			local debounce = false
			local onToggle = functionify(data.OnToggle, new)
			local function toggle(isEnabled)
				if not debounce then
					debounce = true
					if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
						enabled = false
						new.Text = "Disabled"
					elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
						enabled = true
						new.Text = "Enabled"
					end

					if onToggle then
						onToggle(enabled, new)
					end
					debounce = false
				end
			end

			--new.ZIndex = data.ZIndex
			new.Text = (enabled and "Enabled") or "Disabled"
			new.MouseButton1Down:Connect(function()
				if onToggle then
					clickSound:Play()
					RippleEffect(new)
					toggle()
				end
			end)

			new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
		end

		if class == "StringEntry" then
			local box = new.Box
			local ignore

			new.Text = data.Text or new.Text
			box.ZIndex = data.ZIndex or new.ZIndex

			if data.BoxText then
				box.Text = data.BoxText
			end

			if data.BoxProperties then
				for i,v in next,data.BoxProperties do
					if checkProperty(box, i) then
						box[i] = v
					end
				end
			end

			if data.TextChanged then
				local textChanged = functionify(data.TextChanged, box)
				box.Changed:Connect(function(p)
					if p == "Text" and not ignore then
						textChanged(box.Text)
					end
				end)

				box.FocusLost:Connect(function(enter)
					local change = textChanged(box.Text, true, enter)
					if change then
						ignore = true
						box.Text = change
						ignore = false
					end
				end)
			end

			new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
		end

		if class == "Slider" then
			local mouseIsIn = false
			local posValue = new.Percentage
			local slider = new.Slider
			local bar = new.SliderBar
			local drag = new.Drag
			local moving = false
			local value = 0
			local onSlide = functionify(data.OnSlide, new)

			bar.ZIndex = data.ZIndex or new.ZIndex
			slider.ZIndex = bar.ZIndex+1
			drag.ZIndex = slider.ZIndex+1
			drag.Active = true

			if data.Value then
				slider.Position = UDim2.new(0.5, -10, 0.5, -10)
				drag.Position = slider.Position
			end

			bar.InputBegan:Connect(function(input)
				if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)

					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end

					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
					posValue.Value = value

					if onSlide then
						onSlide(value)
					end
				end
			end)

			drag.DragBegin:Connect(function()
				moving = true
			end)

			drag.DragStopped:Connect(function()
				moving = false
				drag.Position = slider.Position
			end)

			drag.Changed:Connect(function()
				if moving then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)

					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end

					slider.Position = UDim2.new(value, -10, 0.5, -10)
					posValue.Value = value

					if onSlide then
						onSlide(value)
					end
				end
			end)

			new:SetSpecial("SetValue",function(ignore, newValue)
				if newValue and tonumber(newValue) then
					value = tonumber(newValue)
					posValue.Value = value
					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
				end
			end)
		end

		if class == "Dropdown" then
			local menu = new.Menu
			local downImg = new.Down
			local selected = new.dSelected
			local options = data.Options
			local curSelected = data.Selected or data.Selection
			local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
			local textProps = data.TextProperties
			local scroller = create("ScrollingFrame", {
				Parent = menu;
				Size = UDim2.new(1, 0, 1, 0);
				Position = UDim2.new(0, 0, 0, 0);
				BackgroundTransparency = 1;
				ZIndex = 100;
			})

			menu.ZIndex = scroller.ZIndex
			menu.Parent = GUI
			menu.Visible = false
			menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
			menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3

			if data.TextAlignment then
				selected.TextXAlignment = data.TextAlignment
				selected.Position = UDim2.new(0, 30, 0, 0);
			end

			if data.NoArrow then
				downImg.Visible = false
			end

			new:SetSpecial("MenuContainer", menu)

			new.Changed:Connect(function(p)
				if p == "AbsolutePosition" and menu.Visible then
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
				elseif p == "AbsoluteSize" or p == "Parent" then
					downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
					if data.TextAlignment == "Right" then
						downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
						selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
					else
						downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
					end

					selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);

					if options and #options <= 6 then
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
					else
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
						scroller:ResizeCanvas(false, true);
					end
				end
			end)

			selected.ZIndex = new.ZIndex
			downImg.ZIndex = new.ZIndex

			if textProps then
				for i,v in next,textProps do
					selected[i] = v
				end
			end

			if options then
				for i,v in next,options do
					local button = scroller:Add("TextButton", {
						Text = "  ".. tostring(v);
						Size = UDim2.new(1, -10, 0, 30);
						Position = UDim2.new(0, 5, 0, 30*(i-1));
						ZIndex = menu.ZIndex;
						BackgroundTransparency = 1;
						OnClick = function()
							selected.Text = v;
							onSelect(v, new);
							menu.Visible = false
						end
					})

					if textProps then
						for i,v in next,textProps do
							button[i] = v
						end
					end
				end

				if curSelected then
					selected.Text = curSelected
				else
					selected.Text = "No Selection"
				end

				local function showMenu()
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
					menu.Visible = not menu.Visible
				end

				selected.MouseButton1Down:Connect(function() clickSound:Play() RippleEffect(selected) showMenu() end)
				downImg.MouseButton1Down:Connect(function() RippleEffect(selected) showMenu() end)
			end
		end

		if class == "TabFrame" then
			local buttonsTab = {};
			local buttons = create("ScrollingFrame", nil, new.Buttons)
			local frames = new.Frames
			local numTabs = 0
			local buttonSize = data.ButtonSize or 60

			new.BackgroundTransparency = data.BackgroundTransparency or 1
			buttons.ZIndex = data.ZIndex or new.ZIndex
			frames.ZIndex = buttons.ZIndex

			new:SetSpecial("GetTab", function(ignore, name)
				return frames:FindFirstChild(name)
			end)

			new:SetSpecial("NewTab", function(ignore, name, data)
				local data = data or {}
				--local numChildren = #frames:GetChildren()
				local nextPos = getNextPos(buttons);
				local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
				local oTextTrans = data.TextTransparency
				local isOpen = false
				local disabled = false
				local tabFrame = create("ScrollingFrame",{
					Name = name;
					Size = UDim2.new(1, 0, 1, 0);
					Position = UDim2.new(0, 0, 0, 0);
					BorderSizePixel = 0;
					BackgroundTransparency = data.FrameTransparency or data.Transparency;
					BackgroundColor3 = data.Color or dSecondaryBackground;
					ZIndex = buttons.ZIndex;
					Visible = false;
				})

				local tabButton = create("TextButton",{
					Name = name;
					Text = data.Text or name;
					Size = UDim2.new(0, textSize.X+20, 1, 0);
					ZIndex = buttons.ZIndex;
					Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
					TextColor3 = data.TextColor;
					BackgroundTransparency = 0.7;
					TextTransparency = data.TextTransparency;
					BackgroundColor3 = data.Color or dSecondaryBackground;
					BorderSizePixel = 0;
				})

				tabFrame:SetSpecial("FocusTab",function()
					for i,v in next,buttonsTab do
						if isGui(v) then
							v.BackgroundTransparency = (v:IsDisabled() and 0.9) or 0.7
							v.TextTransparency = (v:IsDisabled() and 0.9) or 0.7
						end
					end

					for i,v in next,frames:GetChildren() do
						if isGui(v) then
							v.Visible = false
						end
					end

					tabButton.BackgroundTransparency = data.Transparency or 0
					tabButton.TextTransparency = data.TextTransparency or 0
					tabFrame.Visible = true

					if data.OnFocus then
						data.OnFocus(true)
					end
				end)

				if numTabs == 0 then
					tabFrame.Visible = true
					tabButton.BackgroundTransparency = data.Transparency or 0
				end

				tabButton.MouseButton1Down:Connect(function()
					if not disabled then
						tabFrame:FocusTab()
					end
				end)

				tabButton.Parent = buttons
				tabFrame.Parent = frames
				buttons:ResizeCanvas(true, false)

				tabFrame:SetSpecial("Disable", function()
					disabled = true;
					tabButton.BackgroundTransparency = 0.9;
					tabButton.TextTransparency = 0.9
				end)

				tabFrame:SetSpecial("Enable", function()
					disabled = false;
					tabButton.BackgroundTransparency = 0.7;
					tabButton.TextTransparency = data.TextTransparency or 0;
				end)

				tabButton:SetSpecial("IsDisabled", function()
					return disabled;
				end)

				table.insert(buttonsTab, tabButton);

				numTabs = numTabs+1;

				return tabFrame,tabButton
			end)
		end

		if class == "ScrollingFrame" then
			local genning = false
			if not data.ScrollBarThickness then
				data.ScrollBarThickness = dScrollBar
			end

			new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
				local list = list or obj;
				local genHold = {}
				local entProps = labelProperties or {}

				genning = genHold
				new:ClearAllChildren()

				local num = 0
				for i,v in next,list do
					local text = v;
					local desc;
					local color
					local richText;

					if type(v) == "table" then
						text = v.Text
						desc = v.Desc
						color = v.Color

						if v.RichTextAllowed or entProps.RichTextAllowed then
							richText = true
						end
					end

					local label = create("TextLabel",{
						Text = " "..tostring(text);
						ToolTip = desc;
						Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
						Visible = true;
						BackgroundTransparency = 1;
						Font = "SourceSans";
						TextSize = 18;
						TextStrokeTransparency = 0.8;
						TextXAlignment = "Left";
						Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
						RichText = richText or false;
					})

					if color then
						label.TextColor3 = color
					end

					if labelProperties then
						for i,v in next,entProps do
							if checkProperty(label, i) then
								label[i] = v
							end
						end
					end

					if genning == genHold then
						label.Parent = new;
					else
						label:Destroy()
						break
					end

					num = num+1

					if data.Delay then
						if type(data.Delay) == "number" then
							wait(data.Delay)
						elseif i%100 == 0 then
							wait(0.1)
						end
					end
				end

				new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
				genning = nil
			end)

			new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
				local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
				local newY, newX = 0,0

				if not onX and not onY then onX = false onY = true end
				for i,v in next,new:GetChildren() do
					if v:IsA("GuiObject") then
						if onY then
							v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
							v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
						end

						if onX then
							v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
							v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
						end

						local yLower = v.Position.Y.Offset + v.Size.Y.Offset
						local xLower = v.Position.X.Offset + v.Size.X.Offset
						newY = math.max(newY, yLower)
						newX = math.max(newX, xLower)
						if modBreak then
							if i%modBreak == 0 then
								wait(1/60)
							end
						end
					end
				end

				if onY then
					new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
				end

				if onX then
					new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
				end

				if xMax then
					new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
				end

				if yMax then
					new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
				end
			end)

			if data.List then new:GenerateList(data.List) data.List = nil end
		end

		LoadChildren(new, data.Content or data.Children)

		data.Children = nil
		data.Content = nil

		for i,v in next,data do
			if checkProperty(new, i) then
				new[i] = v
			end
		end

		new.Parent = parent

		return apiIfy(new, data, class),data
	end

	function apiIfy(gui, data, class)
		local newGui = service.Wrap(gui)
		gui:SetSpecial("Object", gui)
		gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
		gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
		gui:SetSpecial("Add", function(ignore, class, data)
			if not data then data = class class = ignore end
			local new = create(class,data);
			new.Parent = gui;
			return apiIfy(new, data, class)
		end)

		gui:SetSpecial("Copy", function(ignore, class, gotData)
			local newData = {}
			local new

			for i,v in next,data do
				newData[i] = v
			end

			for i,v in next,gotData do
				newData[i] = v
			end

			new = create(class or data.Class or gui.ClassName, newData);
			new.Parent = gotData.Parent or gui.Parent;
			return apiIfy(new, data, class)
		end)

		return newGui
	end

	function doClose()
		if not isClosed then
			isClosed = true
			for _, thing in pairs(Drag:GetChildren()) do
				if thing ~= Main then
					thing:Destroy()
				end
			end
			Drag:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
			Main.ClipsDescendants = true
			Main:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
			wait(0.12)
			gTable:Destroy()
		end
	end

	function isVisible()
		return Main.Visible
	end

	local hideLabel = Hide:FindFirstChild("TextLabel")
	function doHide(doHide)
		local origLH = Hide.LineHeight
		if doHide or (doHide == nil and Main.Visible) then
			dragSize = Drag.Size
			Main.Visible = false
			Main.Glass.Parent = Drag
			Drag.BackgroundTransparency = Main.BackgroundTransparency
			Drag.BackgroundColor3 = Main.BackgroundColor3
			Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)

			if hideLabel then
				hideLabel.Icon.Image = "rbxassetid://3523249191"
			else
				Hide.Icon.Image = "rbxassetid://3523249191"
			end

			Hide.LineHeight = origLH
			gTable.Minimized = true
		elseif doHide == false or (doHide == nil and not Main.Visible) then
			Main.Visible = true
			Drag.Glass.Parent = Main
			Drag.BackgroundTransparency = 1
			Drag.Size = dragSize or Drag.Size

			if hideLabel then
				hideLabel.Icon.Image = "rbxassetid://3523250728"
			else
				Hide.Icon.Image = "rbxassetid://3523250728"
			end

			Hide.LineHeight = origLH
			gTable.Minimized = false
		end

		if onMinimize then
			onMinimize(Main.Visible)
		end

		if Walls then
			wallPosition()
		end
	end

	function isInFrame(x, y, frame)
		if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
			return true
		else
			return false
		end
	end

	function wallPosition()
		if gTable.Active then
			local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
			local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
			local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y

			if x < 0 then
				Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
			end

			if y < 0 then
				Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
			end

			if x + abx > gx then
				Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
			end

			if y + ySize > gy then
				Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
			end
		end
	end

	function setSize(newSize)
		if newSize and type(newSize) == "table" then
			if newSize[1] < 50 then newSize[1] = 50 end
			if newSize[2] < 50 then newSize[2] = 50 end

			Drag.Size = UDim2.new(0,newSize[1],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
			Main.Size = UDim2.new(1,0,0,newSize[2])
		end
	end

	function setPosition(newPos)
		if newPos and typeof(newPos) == "UDim2" then
			Drag.Position = newPos
		elseif newPos and type(newPos) == "table" then
			Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
		elseif Size and not newPos then
			Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
		end
	end

	if Name then
		gTable.Name = Name
		if data.AllowMultiple ~= nil and data.AllowMultiple == false then
			local found, num = client.UI.Get(Name, GUI, true)
			if found then
				doClose()
				return nil
			end
		end
	end

	if Size then
		setSize(Size)
	end

	if Position then
		setPosition(Position)
	end

	if Title then
		Titlef.Text = Title
	end

	if CanKeepAlive or not ResetOnSpawn then
		gTable.CanKeepAlive = true
		GUI.ResetOnSpawn = false
	elseif ResetOnSpawn then
		gTable.CanKeepAlive = false
		GUI.ResetOnSpawn = true
	end

	if Icon then
		Iconf.Visible = true
		Iconf.Image = Icon
	end

	if CanvasSize then
		ScrollFrame.CanvasSize = CanvasSize
	end

	if noClose then
		Close.Visible = false
		Refresh.Position = Hide.Position
		Hide.Position = Close.Position
	end

	if noHide then
		Hide.Visible = false
		Refresh.Position = Hide.Position
	end

	if Walls then
		Drag.DragStopped:Connect(function()
			wallPosition()
		end)
	end

	if onRefresh then
		local debounce = false
		function DoRefresh()
			if not Refreshing then
				local done = false
				Refreshing = true

				spawn(function()
					while gTable.Active and not done do
						for i = 0,180,10 do
							rSpinner.Rotation = -i
							wait(1/60)
						end
					end
				end)

				onRefresh()
				wait(1)
				done = true
				Refreshing = false
			end
		end

		Refresh.MouseButton1Down:Connect(function()
			clickSound:Play()
			RippleEffect(Refresh)
			if not debounce then
				debounce = true
				DoRefresh()
				debounce = false
			end
		end)

		Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
	else
		Refresh.Visible = false
	end

	if iconClicked then
		Iconf.MouseButton1Down(function()
			clickSound:Play()
			RippleEffect(Iconf)
			iconClicked(data, GUI, Iconf)
		end)
	end

	if Menu then
		data.Menu.Text     = ""
		data.Menu.Parent   = Main
		data.Menu.Size     = UDim2.new(1,-10,0,25)
		data.Menu.Position = UDim2.new(0,5,0,25)
		ScrollFrame.Size   = UDim2.new(1,-10,1,-55)
		ScrollFrame.Position       = UDim2.new(0,5,0,50)
		data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
		data.Menu.BorderSizePixel  = 0
		create("TextLabel",data.Menu)
	end

	if not SizeLocked then
		local startXPos = Drag.AbsolutePosition.X
		local startYPos = Drag.AbsolutePosition.Y
		local startXSize = Drag.AbsoluteSize.X
		local startYSize = Drag.AbsoluteSize.Y
		local vars = client.Variables
		local newIcon
		local inFrame
		local ReallyInFrame

		local function readify(obj)
			obj.MouseEnter:Connect(function()
				ReallyInFrame = obj
			end)

			obj.MouseLeave:Connect(function()
				if ReallyInFrame == obj then
					ReallyInFrame = nil
				end
			end)
		end

		--[[
		readify(Drag)
		readify(ScrollFrame)
		readify(TopRight)
		readify(TopLeft)
		readify(RightCorner)
		readify(LeftCorner)
		readify(RightSide)
		readify(LeftSide)
		readify(Bottom)
		readify(Top)
		--]]

		function checkMouse(x, y) --// Update later to remove frame by frame pos checking
			if gTable.Active and Main.Visible then
				if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
					inFrame = nil
					newIcon = nil
				elseif isInFrame(x, y, TopRight) then
					inFrame = "TopRight"
					newIcon = MouseIcons.TopRight
				elseif isInFrame(x, y, TopLeft) then
					inFrame = "TopLeft"
					newIcon = MouseIcons.TopLeft
				elseif isInFrame(x, y, RightCorner) then
					inFrame = "RightCorner"
					newIcon = MouseIcons.RightCorner
				elseif isInFrame(x, y, LeftCorner) then
					inFrame = "LeftCorner"
					newIcon = MouseIcons.LeftCorner
				elseif isInFrame(x, y, RightSide) then
					inFrame = "RightSide"
					newIcon = MouseIcons.Horizontal
				elseif isInFrame(x, y, LeftSide) then
					inFrame = "LeftSide"
					newIcon = MouseIcons.Horizontal
				elseif isInFrame(x, y, Bottom) then
					inFrame = "Bottom"
					newIcon = MouseIcons.Vertical
				elseif isInFrame(x, y, Top) then
					inFrame = "Top"
					newIcon = MouseIcons.Vertical
				else
					inFrame = nil
					newIcon = nil
				end
			else
				inFrame = nil
			end

			if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
				if inFrame and newIcon then
					Mouse.Icon = newIcon
					client.Variables.MouseLockedBy = gTable
				elseif client.Variables.MouseLockedBy == gTable then
					Mouse.Icon = curIcon
					client.Variables.MouseLockedBy = nil
				end
			end
		end

		local function inputStart(x, y)
			checkMouse(x, y)
			if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
				Resizing = inFrame
				startXPos = Drag.AbsolutePosition.X
				startYPos = Drag.AbsolutePosition.Y
				startXSize = Drag.AbsoluteSize.X
				startYSize = Main.AbsoluteSize.Y
			end
		end

		local function inputEnd()
			if gTable.Active then
				if Resizing and onResize then
					onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
				end

				Resizing = nil
				Mouse.Icon = curIcon
				--DragEnabled = true
				--if Walls then
				--	wallPosition()
				--end
			end
		end

		local function inputMoved(x, y)
			if gTable.Active then
				if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
					curIcon = Mouse.Icon
				end

				if Resizing then
					local moveX = false
					local moveY = false
					local newPos = Drag.Position
					local xPos, yPos = x, y
					local newX, newY = startXSize, startYSize

					--DragEnabled = false

					if Resizing == "TopRight" then
						newX = (xPos - startXPos) + 3
						newY = (startYPos - yPos) + startYSize -1
						moveY = true
					elseif Resizing == "TopLeft" then
						newX = (startXPos - xPos) + startXSize -1
						newY = (startYPos - yPos) + startYSize -1
						moveY = true
						moveX = true
					elseif Resizing == "RightCorner" then
						newX = (xPos - startXPos) + 3
						newY = (yPos - startYPos) + 3
					elseif Resizing == "LeftCorner" then
						newX = (startXPos - xPos) + startXSize + 3
						newY = (yPos - startYPos) + 3
						moveX = true
					elseif Resizing == "LeftSide" then
						newX = (startXPos - xPos) + startXSize + 3
						newY = startYSize
						moveX = true
					elseif Resizing == "RightSide" then
						newX = (xPos - startXPos) + 3
						newY = startYSize
					elseif Resizing == "Bottom" then
						newX = startXSize
						newY = (yPos - startYPos) + 3
					elseif Resizing == "Top" then
						newX = startXSize
						newY = (startYPos - yPos) + startYSize - 1
						moveY = true
					end

					if newX < MinSize[1] then newX = MinSize[1]  end
					if newY < MinSize[2] then newY = MinSize[2] end
					if newX > MaxSize[1] then newX = MaxSize[1] end
					if newY > MaxSize[2] then newY = MaxSize[2] end

					if moveX then
						newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
					end

					if moveY then
						newPos  = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
					end

					Drag.Position = newPos
					Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
					Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)

					if not Titlef.TextFits then
						Titlef.Visible = false
					else
						Titlef.Visible = true
					end
				else
					checkMouse(x, y)
				end
			end
		end

		Event(InputService.InputBegan, function(input, gameHandled)
			if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				inputStart(Mouse.X, Mouse.Y)
			end
		end)

		Event(InputService.InputChanged, function(input, gameHandled)
			if input.UserInputType == Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch then
				inputMoved(input.Position.X, input.Position.Y)
			end
		end)

		Event(InputService.InputEnded, function(input, gameHandled)
			if input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch then
				inputEnd()
			end
		end)

		--[[Event(Mouse.Button1Down, function()
			if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
				Resizing = inFrame
				startXPos = Drag.AbsolutePosition.X
				startYPos = Drag.AbsolutePosition.Y
				startXSize = Drag.AbsoluteSize.X
				startYSize = Main.AbsoluteSize.Y
				checkMouse()
			end
		end)

		Event(Mouse.Button1Up, function()
			if gTable.Active then
				if Resizing and onResize then
					onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
				end

				Resizing = nil
				Mouse.Icon = curIcon
				--if Walls then
				--	wallPosition()
				--end
			end
		end)--]]
	else
		LeftSizeIcon.Visible  = false
		RightSizeIcon.Visible = false
	end

	Close.MouseButton1Click:Connect(function() clickSound:Play() doClose() end)
	Hide.MouseButton1Click:Connect(function() clickSound:Play() doHide() end)

	Close.MouseButton1Down:Connect(function() RippleEffect(Close) end)
	Hide.MouseButton1Down:Connect(function() RippleEffect(Hide) end)

	gTable.CustomDestroy = function()
		service.UnWrap(GUI):Destroy()
		if client.Variables.MouseLockedBy == gTable then
			Mouse.Icon = curIcon
			client.Variables.MouseLockedBy = nil
		end

		if not isClosed then
			isClosed = true
			if onClose then
				onClose()
			end
		end
	end

	for i,child in next,GUI:GetChildren() do
		if child.Name ~= "Desc" and child.Name ~= "Drag" then
			specialInsts[child.Name] = child
			child.Parent = nil
		end
	end

	--// Drag & DisplayOrder Handler
	do
		local windowValue = Instance.new("BoolValue", GUI)
		local dragDragging = false
		local dragOffset
		local inFrame

		windowValue.Name = "__ADONIS_WINDOW"

		Event(Main.InputBegan, function(input)
			if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				BringToFront()
			end
		end)

		Event(Drag.InputBegan, function(input)
			if gTable.Active then
				inFrame = true

				if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
					BringToFront()
				end
			end
		end)

		Event(Drag.InputChanged, function(input)
			if gTable.Active then
				inFrame = true
			end
		end)

		Event(Drag.InputEnded, function(input)
			inFrame = false
		end)

		Event(InputService.InputBegan, function(input)
			if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
				dragDragging = true
				BringToFront()
				dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
			end
		end)

		Event(InputService.InputChanged, function(input)
			if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
				Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
			end
		end)

		Event(InputService.InputEnded, function(input)
			if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
				dragDragging = false
			end
		end)
	end

	--// Finishing up
	local api = apiIfy(ScrollFrame, data)
	local meta = api:GetMetatable()
	local oldNewIndex = meta.__newindex
	local oldIndex = meta.__index

	create("ScrollingFrame", nil, ScrollFrame)
	LoadChildren(api, Content)

	api:SetSpecial("gTable", gTable)
	api:SetSpecial("Window", GUI)
	api:SetSpecial("Main", Main)
	api:SetSpecial("Title", Titlef)
	api:SetSpecial("Dragger", Drag)
	api:SetSpecial("Destroy", doClose)
	api:SetSpecial("Close", doClose)
	api:SetSpecial("Object", ScrollFrame)
	api:SetSpecial("Refresh", DoRefresh)
	api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
	api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
	api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
	api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
	api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
	api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
	api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
	api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
	api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
	api:SetSpecial("IsVisible", isVisible)
	api:SetSpecial("IsClosed", isClosed)

	meta.__index = function(tab, ind)
		if ind == "IsVisible" then
			return isVisible()
		elseif ind == "Closed" then
			return isClosed
		else
			return oldIndex(tab, ind)
		end
	end

	setSize(Size)
	setPosition(Position)

	if Ready then
		gTable:Ready()
		BringToFront()
	end

	return api,GUI
end


Prompt: -- loop through all the arm parts and make them visible in first person

Response:
local function setArmVisibility(bool)
	local castshadow = not bool
	for i, part in ipairs(ArmPartsTable) do
		part.LocalTransparencyModifier = armTransparency
		part.CastShadow = castshadow
	end
end

local function toggleViewmodel(toggle)
	isFirstPerson = toggle --// Update the first person state
	Viewmodel.Parent = toggle and workspace.CurrentCamera or nil --// Put the Viewmodel in the camera, or take it out
	RightShoulderClone.Enabled = toggle --// Update joints
	LeftShoulderClone.Enabled = toggle
	LeftShoulder.Enabled = (not toggle) --// Update the original joints (to prevent :fling incidents)
	RightShoulder.Enabled = (not toggle)
	if toggle then
		RightShoulderClone.Part1 = RightArm
		RightShoulderClone.Part0 = FakeTorso
		RightShoulderClone.Parent = FakeTorso
		--// I'm not sure what the point of doing this here is. I'm too scared to change it though because this code is AWFUL.
		--// God knows what would happen.
		LeftShoulderClone.Part1 = LeftArm
		LeftShoulderClone.Part0 = FakeTorso
		LeftShoulderClone.Parent = FakeTorso
	end
end


Prompt: -- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/installCommonGlobals.ts


Prompt: -- only 2 locals,yeah...

Response:
local player = game.Players.LocalPlayer
local char = player.Character
char:WaitForChild("Humanoid").Died:Connect(function() --check if player got oofed
	wait()
	script.Parent.BackgroundTransparency = 0 -- make it not transparent(just to be 100% sure it will be visible after)
	player.CameraMode = 0 -- set third person
	player.CameraMaxZoomDistance = 3 -- lock the camera zoom
    player.CameraMinZoomDistance = 3
	wait(1)
	script.Parent.Deathsound:Play() -- play the sound
	wait(1)
	script.Parent.Visible = true -- make screen go black xd
	player.CameraMaxZoomDistance = 0.5 --reset the zoom
	player.CameraMinZoomDistance = 0.5
	player.CameraMode = 1 -- set first person
	wait(3) -- screen fade out UwU
	script.Parent.BackgroundTransparency = 0.1
	wait(0.3)
	script.Parent.BackgroundTransparency = 0.2
	wait(0.3)
	script.Parent.BackgroundTransparency = 0.3
	wait(0.2)
	script.Parent.BackgroundTransparency = 0.4
	wait(0.2)
	script.Parent.BackgroundTransparency = 0.6
	wait(0.1)
	script.Parent.BackgroundTransparency = 0.8
	wait(0.1)
	script.Parent.BackgroundTransparency = 1
	script.Parent.Visible = false -- make it invisible(just to be sure again)
end)


Prompt: --create tables:

Response:
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "c" then
		table.insert(c, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "d" then
		table.insert(d, 1, part)
	end
end

function lightOn(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = true
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = true
		end
	end
end

function lightOff(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = false
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = false
		end
	end
end
while true do
	local w2 = (math.random(2,7))/17

	lightOn(c)
	wait(0.12)

	lightOff(c)
	wait(w2)

	lightOn(d)
	wait(0.12)

	lightOff(d)
	wait(w2)

end


Prompt: -- Services

Response:
local ContextActionSerice = game:GetService("ContextActionService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local DebrisService = game:GetService("Debris")
local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")


Response:
local  Paint = false

script.Parent.MouseButton1Click:connect(function()
	Paint = not Paint
	handler:FireServer("Toothpaste",Paint)
end)


Prompt: -------- OMG HAX

Response:
r = game:service("RunService")

local damage = 20

local slash_damage = 0

sword = script.Parent.Handle
Tool = script.Parent

function attack()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
end

Tool.Enabled = true

function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		return
	end

	attack()

	wait(1)

	Tool.Enabled = true
end

script.Parent.Activated:connect(onActivated)


Prompt:
--[=[
	Observes all children of a specific class

	@param parent Instance
	@param className string
	@return Observable<Instance>
]=]

Response:
function RxInstanceUtils.observeChildrenOfClassBrio(parent, className)
	assert(typeof(parent) == "Instance", "Bad parent")
	assert(type(className) == "string", "Bad className")

	return RxInstanceUtils.observeChildrenBrio(parent, function(child)
		return child:IsA(className)
	end)
end


Prompt:
--[[

	Quicker (and limited) way to use TweenService since the default synax takes up a paragraph. Supports tuple of instances.

	Functions.FastTween(
		instance,				<-- |REQ| 	Instance that will be tweened
		{property = 300},		<-- |REQ|	Dictionary of properties and their values
		{speed, style, dir}		<-- |REQ|	Array: Speed (sec), Style (str), Direction (str)	[defaults to: {1, "Sine", "InOut"}]
	)

--]]

Response:
return function(_entity, tweenGoals, tweenInfoRaw)
	--- Allow for multipule instances
	if type(_entity) ~= "table" then  _entity = {_entity}  end

	--- Variables
	local tweens = {}

	--- iterate through each instance
	for _, entity in ipairs(_entity) do
		if tweenInfoRaw == nil then
			--- No tweenInfo provided. Use the default one!
			tweenInfoRaw = {
				1,
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out,
			}
		else
			--- Check (2nd) tween arguments and fix/fill them
			if tweenInfoRaw[2] == nil then
				--- No easing style provided. Use default one!
				tweenInfoRaw[2] = Enum.EasingStyle.Sine

			elseif type(tweenInfoRaw[2]) == "string" then
				--- Easing style provided string not enum. Convert!
				tweenInfoRaw[2] = Enum.EasingStyle[tweenInfoRaw[2]]
			end

			--- Check (3rd) tween arguments and fix/fill them
			if tweenInfoRaw[3] == nil then
				--- No easing direction provided. Use default one!
				tweenInfoRaw[3] = Enum.EasingDirection.InOut

			elseif type(tweenInfoRaw[3]) == "string" then
				--- Easing direction provided string not enum. Convert!
				tweenInfoRaw[3] = Enum.EasingDirection[tweenInfoRaw[3]]
			end
		end

		--- Create tween
		local tweenInfo = TweenInfo.new(unpack(tweenInfoRaw))
		local tweenGoals = tweenGoals
		local tween = _L.Services.TweenService:Create(entity, tweenInfo, tweenGoals)

		--- Play tween
		tween:Play()

		--- Add tween to list of tweens that will be returned
		table.insert(tweens, tween)
	end

	--
	return unpack(tweens)
end


Prompt:
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]

Response:
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=script.Parent.Configuration.NoticeDistance.Value;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=30;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;


Prompt: --Automatic Gauge Scaling

Response:
if autoscaling then
	local Drive={}
	if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
		if car.Wheels:FindFirstChild("FL")~= nil then
			table.insert(Drive,car.Wheels.FL)
		end
		if car.Wheels:FindFirstChild("FR")~= nil then
			table.insert(Drive,car.Wheels.FR)
		end
		if car.Wheels:FindFirstChild("F")~= nil then
			table.insert(Drive,car.Wheels.F)
		end
	end
	if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
		if car.Wheels:FindFirstChild("RL")~= nil then
			table.insert(Drive,car.Wheels.RL)
		end
		if car.Wheels:FindFirstChild("RR")~= nil then
			table.insert(Drive,car.Wheels.RR)
		end
		if car.Wheels:FindFirstChild("R")~= nil then
			table.insert(Drive,car.Wheels.R)
		end
	end

	local wDia = 0
	for i,v in pairs(Drive) do
		if v.Size.x>wDia then wDia = v.Size.x end
	end
	Drive = nil
	for i,v in pairs(UNITS) do
		v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
		v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
	end
end

for i=0,revEnd*2 do
	local ln = script.Parent.ln:clone()
	ln.Parent = script.Parent.Tach
	ln.Rotation = 45 + i * 225 / (revEnd*2)
	ln.Num.Text = i/2
	ln.Num.Rotation = -ln.Rotation
	if i*500>=math.floor(_pRPM/500)*500 then
		ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
		if i<revEnd*2 then
			ln2 = ln:clone()
			ln2.Parent = script.Parent.Tach
			ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
			ln2.Num:Destroy()
			ln2.Visible=true
		end
	end
	if i%2==0 then
		ln.Frame.Size = UDim2.new(0,3,0,10)
		ln.Frame.Position = UDim2.new(0,-1,0,100)
		ln.Num.Visible = true
	else
		ln.Num:Destroy()
	end
	ln.Visible=true
end

local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
	local ln = script.Parent.ln:clone()
	ln.Parent = lns
	ln.Rotation = 45 + 225*(i/90)
	if i%2==0 then
		ln.Frame.Size = UDim2.new(0,2,0,10)
		ln.Frame.Position = UDim2.new(0,-1,0,100)
	else
		ln.Frame.Size = UDim2.new(0,3,0,5)
	end
	ln.Num:Destroy()
	ln.Visible=true
end

for i,v in pairs(UNITS) do
	local lnn = Instance.new("Frame",script.Parent.Speedo)
	lnn.BackgroundTransparency = 1
	lnn.BorderSizePixel = 0
	lnn.Size = UDim2.new(0,0,0,0)
	lnn.Name = v.units
	if i~= 1 then lnn.Visible=false end

	for i=0,v.maxSpeed,v.spInc do
		local ln = script.Parent.ln:clone()
		ln.Parent = lnn
		ln.Rotation = 45 + 225*(i/v.maxSpeed)
		ln.Num.Text = i
		ln.Num.TextSize = 14
		ln.Num.Rotation = -ln.Rotation
		ln.Frame:Destroy()
		ln.Num.Visible=true
		ln.Visible=true
	end
end

if 	script.Parent.Parent.IsOn.Value then
	script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end

script.Parent.Parent.IsOn.Changed:connect(function()
	if script.Parent.Parent.IsOn.Value then
		script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
	end
end)

script.Parent.Parent.Values.RPM.Changed:connect(function()
	script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)

script.Parent.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Parent.Values.Gear.Value
	if gearText == 0 then gearText = "N"
	elseif gearText == -1 then gearText = "R"
	end
	script.Parent.Gear.Text = gearText
end)

script.Parent.Parent.Values.TCS.Changed:connect(function()
	if _Tune.TCSEnabled then
		if script.Parent.Parent.Values.TCS.Value then
			script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
			script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
			if script.Parent.Parent.Values.TCSActive.Value then
				wait()
				script.Parent.TCS.Visible = not script.Parent.TCS.Visible
			else
				wait()
				script.Parent.TCS.Visible = false
			end
		else
			script.Parent.TCS.Visible = true
			script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
			script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
		end
	else
		script.Parent.TCS.Visible = false
	end
end)

script.Parent.Parent.Values.TCSActive.Changed:connect(function()
	if _Tune.TCSEnabled then
		if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
			wait()
			script.Parent.TCS.Visible = not script.Parent.TCS.Visible
		elseif not script.Parent.Parent.Values.TCS.Value then
			wait()
			script.Parent.TCS.Visible = true
		else
			wait()
			script.Parent.TCS.Visible = false
		end
	else
		script.Parent.TCS.Visible = false
	end
end)

script.Parent.TCS.Changed:connect(function()
	if _Tune.TCSEnabled then
		if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
			wait()
			script.Parent.TCS.Visible = not script.Parent.TCS.Visible
		elseif not script.Parent.Parent.Values.TCS.Value then
			wait()
			script.Parent.TCS.Visible = true
		end
	else
		if script.Parent.TCS.Visible then
			script.Parent.TCS.Visible = false
		end
	end
end)

script.Parent.Parent.Values.ABS.Changed:connect(function()
	if _Tune.ABSEnabled then
		if script.Parent.Parent.Values.ABS.Value then
			script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
			script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
			if script.Parent.Parent.Values.ABSActive.Value then
				wait()
				script.Parent.ABS.Visible = not script.Parent.ABS.Visible
			else
				wait()
				script.Parent.ABS.Visible = false
			end
		else
			script.Parent.ABS.Visible = true
			script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
			script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
		end
	else
		script.Parent.ABS.Visible = false
	end
end)

script.Parent.Parent.Values.ABSActive.Changed:connect(function()
	if _Tune.ABSEnabled then
		if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
			wait()
			script.Parent.ABS.Visible = not script.Parent.ABS.Visible
		elseif not script.Parent.Parent.Values.ABS.Value then
			wait()
			script.Parent.ABS.Visible = true
		else
			wait()
			script.Parent.ABS.Visible = false
		end
	else
		script.Parent.ABS.Visible = false
	end
end)

script.Parent.ABS.Changed:connect(function()
	if _Tune.ABSEnabled then
		if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
			wait()
			script.Parent.ABS.Visible = not script.Parent.ABS.Visible
		elseif not script.Parent.Parent.Values.ABS.Value then
			wait()
			script.Parent.ABS.Visible = true
		end
	else
		if script.Parent.ABS.Visible then
			script.Parent.ABS.Visible = false
		end
	end
end)

function PBrake()
	script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)

function Gear()
	if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
		script.Parent.TMode.Text = "A/T"
		script.Parent.TMode.BackgroundColor3 = Color3.new(0, 0, 0)
	elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
		script.Parent.TMode.Text = "S/T"
		script.Parent.TMode.BackgroundColor3 = Color3.new(0, 0, 0)
	end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)

script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
	script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
	script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)

script.Parent.Speed.MouseButton1Click:connect(function()
	if currentUnits==#UNITS then
		currentUnits = 1
	else
		currentUnits = currentUnits+1
	end
	for i,v in pairs(script.Parent.Speedo:GetChildren()) do
		v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
	end
	script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)

wait(.1)
Gear()
PBrake()


Response:
if 	script.Parent.Parent.Parent.IsOn.Value then
	script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end

script.Parent.Parent.Parent.IsOn.Changed:connect(function()
	if script.Parent.Parent.Parent.IsOn.Value then
		script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
	end
end)

	script.Parent.MouseButton1Click:connect(function()
		if lhinge.DesiredAngle == 0 then
			sound.SoundId = "rbxassetid://278329638"
			sound:Play()
			for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
				child.Material = Enum.Material.Neon
			end
			for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
				child.Material = Enum.Material.Neon
			end
			for index, child in pairs(car.Body.Lights.L:GetChildren()) do
				child.Material = Enum.Material.Neon
					if child.Name == V then --TESTING
					child.Transparency = 0 --TESTING
				end
			end
			car.Misc.Popups.left.Parts.L.L.L.Enabled = true
			car.Misc.Popups.right.Parts.L.L.L.Enabled = true
			wait(.05)
			lhinge.DesiredAngle = 0.6
			rhinge.DesiredAngle = 0.6
		else
			for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
				child.Material = Enum.Material.SmoothPlastic
			end
			for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
				child.Material = Enum.Material.SmoothPlastic
			end
			for index, child in pairs(car.Body.Lights.L:GetChildren()) do
				child.Material = Enum.Material.SmoothPlastic
					if child.Name == V then --TESTING
					child.Transparency = 1 --TESTING
					end

			end
			car.Misc.Popups.left.Parts.L.L.L.Enabled = false
			car.Misc.Popups.right.Parts.L.L.L.Enabled = false
			lhinge.DesiredAngle = 0
			rhinge.DesiredAngle = 0
			sound.SoundId = "rbxassetid://278329638"
			sound:Play()
		end
	end)

		script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
		if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 then
			for index, child in pairs(car.Body.Lights.B:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			child.Transparency = 1
			end
			car.Body.Lights.B.L.L.Enabled = false
		else
			for index, child in pairs(car.Body.Lights.B:GetChildren()) do
			child.Material = Enum.Material.Neon
			child.Transparency = 0
			end
			car.Body.Lights.B.L.L.Enabled = true
		end
	end)

	script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
		if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
			for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.Neon
			car.DriveSeat.Reverse:Play()
			end
		else
			for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			car.DriveSeat.Reverse:Stop()
			end
		end
	end)

	while wait() do
		if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
		car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
		car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
		else
		car.DriveSeat.Reverse.Pitch = 1.3
		car.DriveSeat.Reverse.Volume = .5
		end
	end


Prompt: -- Backwards compatibility

Response:
Promise.prototype.awaitValue = Promise.prototype.expect
Promise.prototype.AwaitValue = Promise.prototype.expect


Prompt: --//Limits//--

Response:
if InductionPartSize < 0 then
	InductionPartSize  = 0
elseif InductionPartSize > 5 then
	InductionPartSize = 5
end

if WeightDistribution < 0 then
	WeightDistribution  = 0
elseif WeightDistribution  > 100 then
	WeightDistribution = 100
end

if SteeringAngle > 120 then
	SteeringAngle = 120
elseif SteeringAngle < 20 then
	SteeringAngle = 20
end

if TiresFront > 3 then
	TiresFront = 3
elseif TiresFront < 1 then
	TiresFront = 1
end

if TiresRear  > 3 then
	TiresRear  = 3
elseif TiresRear  < 1 then
	TiresRear  = 1
end

if DownforceF < 0 then
	DownforceF = 0
elseif DownforceF > 5 then
	DownforceF  = 5
end

if DownforceR  < 0 then
	DownforceR  = 0
elseif DownforceR  > 5 then
	DownforceR   = 5
end

if EngineType == "Electric" then
	TransmissionType = "Automatic"
	InductionPartSize = 0
end

if BrakeBias > 100 then
	BrakeBias  = 100
elseif BrakeBias  < 0 then
	BrakeBias = 0
end

if BrakePower > 100 then
	BrakePower = 100
elseif BrakePower < 0 then
	BrakePower = 0
end

if AmountOfGears > 8 then
	AmountOfGears  = 8
elseif AmountOfGears < 1 then
	AmountOfGears = 1
end

if TransmissionType ~= "HPattern" and TransmissionType ~= "Automatic" and TransmissionType ~= "DualClutch" and TransmissionType ~= "CVT" then
TransmissionType = "Automatic"
end

if Drivetrain ~= "AWD" and Drivetrain ~= "FWD" and Drivetrain ~= "RWD" then
	Drivetrain = "FWD"
end

if TorqueSplit > 100 then
	TorqueSplit = 100
elseif TorqueSplit < 0 then
	TorqueSplit = 0
end

if Drivetrain == "RWD" then
	TorqueSplit = 100
	DifferentialF = 0
elseif Drivetrain == "FWD" then
	TorqueSplit = 0
	DifferentialR = 0
end

if DifferentialF > 1 then
	DifferentialF  = 1
elseif DifferentialF < 0 then
	DifferentialF = 0
end

if DifferentialR > 1 then
	DifferentialR = 1
elseif DifferentialR  < 0 then
	DifferentialR = 0
end

if Gear1 > 5 then
	Gear1 = 5
elseif Gear1 < 0.1 then
	Gear1 = 0.1
end

if Gear2 > 5 then
	Gear2 = 5
elseif Gear2 < 0.1 then
	Gear2 = 0.1
end

if Gear3 > 5 then
	Gear3 = 5
elseif Gear3 < 0.1 then
	Gear3 = 0.1
end

if Gear4 > 5 then
	Gear4 = 5
elseif Gear4 < 0.1 then
	Gear4 = 0.1
end

if Gear5 > 5 then
	Gear5 = 5
elseif Gear5 < 0.1 then
	Gear5 = 0.1
end

if Gear6 > 5 then
	Gear6 = 5
elseif Gear6 < 0.1 then
	Gear6 = 0.1
end

if Gear7 > 5 then
	Gear7 = 5
elseif Gear7 < 0.1 then
	Gear7 = 0.1
end

if Gear8 > 5 then
	Gear8 = 5
elseif Gear8 < 0.1 then
	Gear8 = 0.1
end

if FinalDrive > 5 then
	FinalDrive = 6.08 - 5
elseif FinalDrive < 0.1 then
	FinalDrive = 6.08 - 0.1
end

if EngineIdle > 1600 then
	EngineIdle = 1600
elseif EngineIdle < 300 then
	EngineIdle = 300
end

if RideHeightFront > 5 then
	RideHeightFront = 5
elseif RideHeightFront < 0 then
	RideHeightFront = 0
end

if RideHeightRear > 5 then
	RideHeightRear = 5
elseif RideHeightRear < 0 then
	RideHeightRear = 0
end

if StiffnessFront > 10 then
	StiffnessFront = 10
elseif StiffnessFront < 0 then
	StiffnessFront = 0
end

if StiffnessRear > 10 then
	StiffnessRear = 10
elseif StiffnessRear < 0 then
	StiffnessRear = 0
end

if AntiRollFront > 10 then
	AntiRollFront = 10
elseif AntiRollFront < 0 then
	AntiRollFront = 0
end

if AntiRollRear > 10 then
	AntiRollRear = 10
elseif AntiRollRear < 0 then
	AntiRollRear = 0
end

if CamberFront > 10 then
	CamberFront = 10
elseif CamberFront < -11 then
	CamberFront = -11
end

if CamberRear > 10 then
	CamberRear = 10
elseif CamberRear < -11 then
	CamberRear = -11
end

if EngineType == "Electric" then
 EngineRedline = 16200
end


Prompt:
--[[
	Shorthand for an andThen handler that returns the given value.
]]

Response:
function Promise.prototype:andThenReturn(...)
	local length, values = pack(...)
	return self:_andThen(debug.traceback(nil, 2), function()
		return unpack(values, 1, length)
	end)
end
Promise.prototype.AndThenReturn = Promise.prototype.andThenReturn
Promise.prototype.ThenReturn = Promise.prototype.andThenReturn


Prompt: -- Services

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


Response:
ClickDetector1.MouseClick:Connect(function()
	if Ready == true then
		if Open == false then
			Ready = false
			Open = true
			OpenSound:Play()
			OpenTween:Play()
			OpenTween1:Play()
			wait(.5)
			Ready = true
		elseif Open == true then
			Ready = false
			Open = false
			CloseSound:Play()
			CloseTween:Play()
			CloseTween1:Play()
			wait(.5)
			Ready = true
		end
	end
end)


Response:
local enabled = false

local function ToggleFreecam()
	if enabled then
		StopFreecam()
	else
		StartFreecam()
	end
	enabled = not enabled
end

Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
StartFreecam()
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
Players.LocalPlayer.CharacterAdded:Connect(function()
	Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
	StartFreecam()
end)
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
StartFreecam()

	--[[Network:BindEvents({
		SetCameraPos = function(Pos)
			ToggleFreecam()

			ToggleFreecam()
		end,
	})]]


Prompt: --// Event Connections

Response:
L_90_.OnClientEvent:connect(function(L_275_arg1, L_276_arg2)
	if L_275_arg1 ~= L_2_ then
		local L_277_ = L_275_arg1.Character
		local L_278_ = L_277_.AnimBase.AnimBaseW
		local L_279_ = L_278_.C1
		if L_276_arg2 then
			L_102_(L_278_,  nil , L_277_.Head.CFrame, function(L_280_arg1)
				return math.sin(math.rad(L_280_arg1))
			end, 0.25)
		elseif not L_276_arg2 then
			L_102_(L_278_,  nil , L_279_, function(L_281_arg1)
				return math.sin(math.rad(L_281_arg1))
			end, 0.25)
		end
	end
end)


Response:
local _WHEELTUNE = {
																		--[[
			SS6 Presets
	[Eco]
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,

	--Friction and Wear

	FWearSpeed		= 0.75	,
	FTargetFriction	= 1.75	,
	FMinFriction 	= .1	,

	RWearSpeed		= 0.75	,
	RTargetFriction	= 1.7	,
	RMinFriction	= .1	,

	--Tire Slip
	TCSOffRatio		= 3/4	,
	WheelLockRatio	= 1/1.2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.15	,	--SS6 Default = 1/1.2

	--Wheel Properties
	FFrictionWeight	= 100		,	--SS6 Default = 1
	RFrictionWeight	= 100		,	--SS6 Default = 1
	FLgcyFrWeight	= 100	,
	RLgcyFrWeight	= 100	,

	FElasticity		= 0		,	--SS6 Default = .5
	RElasticity		= 0		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,

	FElastWeight	= 0		,	--SS6 Default = 1
	RElastWeight	= 0		,	--SS6 Default = 1
	FLgcyElWeight	= 0	,
	RLgcyElWeight	= 0	,

	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}


Prompt:
--//=================================\\
--|| SAZERENOS' ARTIFICIAL HEARTBEAT
--\\=================================//

Response:
ArtificialHB = Instance.new("BindableEvent", script)
ArtificialHB.Name = "ArtificialHB"

script:WaitForChild("ArtificialHB")

frame = 1/60
tf = 0
allowframeloss = false
tossremainder = false
lastframe = tick()
script.ArtificialHB:Fire()

game:GetService("RunService").Heartbeat:connect(function(s, p)
	tf = tf + s
	if tf >= frame then
		if allowframeloss then
			script.ArtificialHB:Fire()
			lastframe = tick()
		else
			for i = 1, math.floor(tf / frame) do
				script.ArtificialHB:Fire()
			end
		lastframe = tick()
		end
		if tossremainder then
			tf = 0
		else
			tf = tf - frame * math.floor(tf / frame)
		end
	end
end)

function PositiveAngle(NUMBER)
	if NUMBER >= 0 then
		NUMBER = 0
	end
	return NUMBER
end

function NegativeAngle(NUMBER)
	if NUMBER <= 0 then
		NUMBER = 0
	end
	return NUMBER
end

function Swait(NUMBER)
	if NUMBER == 0 or NUMBER == nil then
		ArtificialHB.Event:wait()
	else
		for i = 1, NUMBER do
			ArtificialHB.Event:wait()
		end
	end
end


Prompt: --Setting up Collision--

Response:
local BulletCases = "BulletCases"

local Success,Error = pcall(function()
	physicsService:CreateCollisionGroup(BulletCases)
end)

if Success then
	print("Created new collision group")
else
	warn("Collision group already exists")
end

physicsService:CollisionGroupSetCollidable(BulletCases,BulletCases,false)

local function IsHeadAccessory(Handle)
	if Handle:FindFirstChild("HatAttachment") or Handle:FindFirstChild("HairAttachment") or Handle:FindFirstChild("NeckAttachment") or Handle:FindFirstChild("FaceFrontAttachment") then
		return true
	else
		return false
	end
end

local function OnLengthChanged(Cast, LastPoint, Direction, Length, Velocity, Bullet)
	if Bullet then
		local BulletLength = Bullet.Size.Z/2
		local Offset = NewCFrame(0,0,-(Length - BulletLength))
		Bullet.CFrame = CFLookAt(LastPoint, LastPoint + Direction):ToWorldSpace(Offset)
	end
end

local function OnHit(Cast, Result, Velocity, Bullet)
	local HitCoroutine = coroutine.create(function()
		local Hit = Result.Instance
		local Damage = random(MinimumDamage,MaximumDamage)

		if Hit.Parent:IsA("Model") and not core.isAlly(Hit.Parent) then
			if Hit.Parent:FindFirstChild("Humanoid") then
				local Humanoid = Hit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid")

				if Hit.Name == "Head" then
					Humanoid:TakeDamage(Damage * headshotmultiplier)
				else
					Humanoid:TakeDamage(Damage)
				end

				local HitSound = NewInstance("Sound",Hit)
				HitSound.PlayOnRemove = true
				HitSound.SoundId = HitFleshSound
				HitSound:Destroy()

				impact.WorldPosition = Result.Position
				impact.BloodCloud:Emit(30)
				impact.BloodParticles:Emit(30)
			else
				local newBulletHole = combat.getBulletHole(Hit)
				newBulletHole.CFrame = NewCFrame(newBulletHole.Position, newBulletHole.Position + Result.Normal)
				newBulletHole.Position = Result.Position

				local debrisAttachment = newBulletHole.DebrisAttachment
				debrisAttachment.TinyDustParticles:Emit(15)
				debrisAttachment.MainDustEffect:Emit(15)
				debrisAttachment.SmokeEffect:Emit(15)

				debrisService:AddItem(newBulletHole,5)

				for i = 1, random(2,3) do
					local chunk = NewInstance("Part")
					chunk.Color = Result.Instance.Color
					chunk.Material = Result.Instance.Material
					local size = random(5)/20
					chunk.Size = NewVector(size,size,size)
					chunk.CFrame = NewCFrame(Result.Position)
					chunk.Anchored = false
					chunk.Velocity = NewVector(random(-20,20),random(10,20),random(-20,20))
					chunk.Parent = workspace.IgnoreFolder
					chunk:SetNetworkOwner(nil)

					physicsService:SetPartCollisionGroup(chunk,BulletCases)
					debrisService:AddItem(chunk,1)
				end

				local HitSound = newBulletHole.ImpactSound
				HitSound.SoundId = HitWallSounds[random(1,#HitWallSounds)]
				HitSound.Volume = 1
				HitSound:Play()
			end
		elseif Hit.Parent:IsA("Accessory") then
			local IsAHeadAccessory = IsHeadAccessory(Hit)
			if Hit.Parent.Parent:IsA("Model") and not core.isAlly(Hit.Parent.Parent) then
				local Model = Hit.Parent.Parent
				if Model:FindFirstChild("Humanoid") then
					if IsAHeadAccessory then
						Model.Humanoid:TakeDamage(Damage * headshotmultiplier)
					else
						Model.Humanoid:TakeDamage(Damage)
					end

					local HitSound = NewInstance("Sound",Hit)
					HitSound.PlayOnRemove = true
					HitSound.SoundId = HitFleshSound
					HitSound:Destroy()

					impact.WorldPosition = Result.Position
					impact.BloodCloud:Emit(30)
					impact.BloodParticles:Emit(30)
				end
			end
		end

	end)

	coroutine.resume(HitCoroutine)
end

function combat.getBulletHole(partHit)
	local bulletHole = bulletHoleCopy:Clone()
	bulletHole.Parent = workspace.IgnoreFolder

	local debrisAttachment = bulletHole.DebrisAttachment
	local decal = bulletHole.Decal

	decal.Color3 = partHit.Color
	debrisAttachment.TinyDustParticles.Color = NewColorSequence(partHit.Color)
	debrisAttachment.MainDustEffect.Color = NewColorSequence(partHit.Color)
	debrisAttachment.SmokeEffect.Color = NewColorSequence(partHit.Color)

	return bulletHole
end

function combat.destroyBulletRelatedCopies()
	bulletCopy:Destroy()
	bulletCaseCopy:Destroy()
	bulletHoleCopy:Destroy()
end

function combat.getBullet() -- only reason im not creating bullet here anymore is because too many attachments and trails and im lazy.
	local bullet = bulletCopy:Clone()
	bullet.Parent = workspace.IgnoreFolder

	return bullet
end

function combat.getCase() -- same thing as bullet
	local case = bulletCaseCopy:Clone()
	case.Parent = workspace.IgnoreFolder

	physicsService:SetPartCollisionGroup(case,BulletCases)

	return case
end

function pushBullet(bullet)
	-- replaced all the code in this function
	bullet.CFrame = barrel.WorldCFrame * Angles(0,-rad(90),0)

	runService.Heartbeat:Wait()

	local origin = barrel.WorldPosition
	local direction = (NewCFrame(origin,(barrel.WorldCFrame * NewCFrame(0,0,-5)).Position) * Angles(rad(random(-spread,spread)),rad(random(-spread,spread)),rad(random(-spread,spread)))).LookVector

	local NewVelocity = direction * bulletspeed

	local NewCaster = FastCast.new()
	local Behaviour = FastCast.newBehavior()

	Behaviour.Acceleration = bulletacceleration
	Behaviour.RaycastParams = Params
	Behaviour.AutoIgnoreFolder = false
	Behaviour.CosmeticBulletContainer = workspace.IgnoreFolder
	Behaviour.MaxDistance = maxdistance

	NewCaster:Fire(origin, direction, NewVelocity, Behaviour)

	local MaxLength = 0 -- value starts at zero and works its way up to the maximum distance as the bullet travels (used to detect how far the cosmetic bullet travels before being destroyed if it reaches max distance)

	NewCaster.LengthChanged:Connect(function(Cast,LastPoint,NewDirection,Length,NewVelocity,Bullet)
		OnLengthChanged(Cast, LastPoint, NewDirection, Length, NewVelocity, Bullet)
		MaxLength += Length

		if bullet then
			local BulletLength = bullet.Size.Z/2
			local Offset = NewCFrame(0,0,-(Length - BulletLength))
			bullet.CFrame = CFLookAt(LastPoint, LastPoint + NewDirection):ToWorldSpace(Offset) * Angles(0,-rad(90),0)
		end

		if MaxLength >= maxdistance and bullet ~= nil then
			bullet:Destroy()
		end
	end)

	NewCaster.RayHit:Connect(function(Cast, Result, Velocity, Bullet)
		OnHit(Cast, Result, Velocity, Bullet)

		debrisService:AddItem(bullet,0.2)
		bullet.Transparency = 1
	end)
end

local flashIndex = 1
function combat.shoot(target)
	if status:get("weaponCool") and not status:get("reloading") then
		status:set("weaponCool",false)

		local shot

		if SemiAtLongRange then
			if core.checkDist(target,myRoot) > 60 then
				shot = 1
			else
				shot = burstamount
			end
		else
			shot = burstamount
		end

		if not fullauto then
			for i = 1, shot do
				if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end

				if not SemiAtLongRange then
					if core.checkDist(myRoot,target) < 7 then break end
				end

				wait(firerate)
				status:set("mag",status:get("mag")-1)

				--flash:Emit(1)
				local FlashCoroutine = coroutine.create(function()
					barrel.MuzzleFlashEffect:Emit(15)
					barrel.MuzzleFlashInnerEffect:Emit(15)
					barrel.SmokeEffect:Emit(3)
					barrel.SparkEffect:Emit(20)
					lightFlash.Enabled = true
					wait(0.05)
					lightFlash.Enabled = false
				end)

				coroutine.resume(FlashCoroutine)
				--bullet.CFrame = m4.CFrame * NewCFrame(0,0.2,-2.5) --z: 0.5

				if shotgunpellets > 1 then
					for i = 1,shotgunpellets,1 do
						spawn(function()
							local bullet = combat.getBullet()
							pushBullet(bullet)
						end)
					end
				else
					local bullet = combat.getBullet()
					pushBullet(bullet)
				end

				local case = combat.getCase()
				case.CFrame = chamber.WorldCFrame
				case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
				case.RotVelocity = NewVector(random(-0.2,0.2),random(-0.2,0.2),random(-0.2,0.2))
				case:SetNetworkOwner(nil)
				debrisService:AddItem(case,2.5)

				fireSound:Play()

				--Kick
				local original = m4.HingeAttach1.Position
				m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
				tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()

			end
		else
			local Params = RaycastParams.new()
			Params.FilterType = Enum.RaycastFilterType.Blacklist
			Params.FilterDescendantsInstances = {marine}

			local Success,Error = pcall(function() -- gonna make sure if something strange happens the whole script wont freeze
				for i = 1, status:get("mag") do
					if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end

					if core.checkDist(myRoot,target) < 7 then break end

					local cansee = false
					local eyesight = workspace:Raycast(myHead.Position,(target.Parent.Head.Position - myHead.Position).Unit * detectionrange,Params)
					pcall(function()
						if eyesight.Instance and eyesight.Instance:IsDescendantOf(target.Parent) then
							cansee = true
						end
					end)

					if not cansee then break end

					wait(firerate)
					status:set("mag",status:get("mag")-1)

					--flash:Emit(1)
					local FlashCoroutine = coroutine.create(function()
						barrel.MuzzleFlashEffect:Emit(15)
						barrel.MuzzleFlashInnerEffect:Emit(15)
						barrel.SmokeEffect:Emit(3)
						barrel.SparkEffect:Emit(20)
						lightFlash.Enabled = true
						wait(0.05)
						lightFlash.Enabled = false
					end)

					coroutine.resume(FlashCoroutine)

					if shotgunpellets > 1 then
						for i = 1,shotgunpellets,1 do
							spawn(function()
								local bullet = combat.getBullet()
								pushBullet(bullet)
							end)
						end
					else
						local bullet = combat.getBullet()
						pushBullet(bullet)
					end

					local case = combat.getCase()
					case.CFrame = chamber.WorldCFrame
					case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
					case.RotVelocity = NewVector(random(-0.2,0.2),random(-0.2,0.2),random(-0.2,0.2))
					case:SetNetworkOwner(nil)
					debrisService:AddItem(case,2.5)

					fireSound:Play()

					--Kick
					local original = m4.HingeAttach1.Position
					m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
					tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()

				end
			end)

			if not Success then
				warn(Error)
			end
		end
		if status:get("mag") <= 0 then
			wait(delaybeforereloading)
			actions.reload()
		end

		--New thread here before
		wait(mySettings.M4.Delay.Value)
		status:set("weaponCool",true)
	end
end

function combat.throwGrenade(target)
	if status:get("weaponCool") and status:get("grenadeCool") then
		status:set("weaponCool",false)
		status:set("grenadeCool",false)
		actions.yieldWeapons()

		local g = marine.Grenade:Clone()
		g.Boom.PlayOnRemove = true
		g.Parent = workspace
		g.CanCollide = true
		g.CFrame = marine["Right Arm"].CFrame * NewCFrame(0,-1.3,0) * Angles(0,0,rad(90))
		g:SetNetworkOwner(nil)
		debrisService:AddItem(g,5)

		marine.Grenade.Transparency = 1

		local w = NewInstance("WeldConstraint",g)
		w.Part0 = marine["Right Arm"]
		w.Part1 = g

		throwAnimation:Play()
		marine.Grenade.Pin:Play()

		--Rotate and throw
		myHuman.AutoRotate = false
		for i=1,4 do
			wait(0.1)
			myRoot.CFrame = CFLookAt(NewVector(myRoot.Position.X,myRoot.Position.Y,myRoot.Position.Z),NewVector(target.Position.X,myRoot.Position.Y,target.Position.Z))
		end
		myHuman.AutoRotate = true

		if myHuman.Health <= 0 then
			return
		end

		throwAnimation:Stop()

		w.Part1 = nil
		local targetPos = target.Position + (target.Velocity)
		troubleshoot.mark(targetPos)
		local dist = core.checkDist(myRoot,target)
		local aimCFrame = CFLookAt(myRoot.Position,targetPos)
		--g.Velocity = (aimCFrame.LookVector + NewVector(0,1.1,0)) * NewVector(dist,dist*1.5,dist)
		g.Velocity = (myRoot.CFrame.LookVector + NewVector(0,1,0)) * NewVector(dist,dist*1.5,dist)

		--Wait until grenade is thrown before it can be primed
		touched = g.Touched:Connect(function(obj)
			if not obj:IsDescendantOf(marine) then
				touched:Disconnect()
				g.HitWall:Play()
				wait(0.5)
				local x = NewInstance("Explosion",workspace)
				x.Position = g.Position
				x.BlastRadius = 16
				x.BlastPressure = 0
				x.Hit:Connect(function(obj,dist)
					local human = obj.Parent:FindFirstChild("Humanoid")
					if human then
						core.applyDamage(human,20-dist)
					end
				end)
				g:Destroy()
				debrisService:AddItem(x,2)
			end
		end)

		local attach0 = g.Attach0
		local attach1 = g.Attach1
		local t = NewInstance("Trail",g)
		t.Attachment0 = attach0
		t.Attachment1 = attach1
		t.Lifetime = 0.5
		t.Color = NewColorSequence(Color3.fromRGB(150,150,150))
		t.WidthScale = NewNumberSequence(1,0)

		core.spawn(function()
			wait(1)
			status:set("weaponCool",true)
			wait(5)
			status:set("grenadeCool",true)
			marine.Grenade.Transparency = 0
		end)
	end
end

local knife = marine.Knife
function combat.stab()

	local canStab = false
	for i,v in pairs(status:get("currentTarget").Parent:GetChildren()) do
		if v:IsA("BasePart") and core.checkDist(v,myRoot) < 7 then
			canStab = true
		end
	end
	if canStab then
		myHuman:MoveTo(status:get("currentTarget").Position)

		knife.Stab:Play()
		knife.Attack:Play()
		knife.KnifeTrail.Enabled = true

		if random(2) == 1 then
			stabAnimation:Play(0.1,1,2)
		else
			stabPunchAnimation:Play()
		end

		local targetcharacter = status:get("currentTarget").Parent
		local human = targetcharacter.Humanoid
		local torso = nil

		if targetcharacter:FindFirstChild("Torso") then
			torso = targetcharacter.Torso
		elseif targetcharacter:FindFirstChild("UpperTorso") then
			torso = targetcharacter.UpperTorso
		end

		core.applyDamage(human,random(MinimumDamage,MaximumDamage))
		if human.Health <= 0 then
			targeting.findTarget()
		end

		if torso then
			impact.WorldPosition = torso.Position + NewVector(random(-0.5,0.5),random(-0.5,0.5),random(-0.5,0.5))
			impact.BloodCloud:Emit(30)
			impact.BloodParticles:Emit(30)
		end

		--stabAnimation.Stopped:Wait()
		wait(0.5)
		knife.KnifeTrail.Enabled = false
	else
		wait(0.2)
	end
end

function combat.checkCluster(target)
	--Check for nearby allies
	for i,v in ipairs(status:get("activeAllies")) do
		if core.checkDist(target,v) < 30 then
			return false
		end
	end
	--Check if enemies are paired close together
	for i,v in ipairs(status:get("potentialTargets")) do
		if v ~= target then
			if core.checkDist(target,v) < 15 then
				return true
			end
		end
	end
	return false
end

return combat