Roblox/luau_corpus huggingface dataset:
-----------------------------------------------



function findAllFlagStands(root)
	local c = root:children()
	for i=1,#c do
		if (c[i].className == "Model" or c[i].className == "Part") then
			findAllFlagStands(c[i])
		end
		if (c[i].className == "FlagStand") then
			table.insert(stands, c[i])
		end
	end
end

function hookUpListeners()
	for i=1,#stands do
		stands[i].FlagCaptured:connect(onCaptureScored)
	end
end

function onPlayerEntered(newPlayer)

	if CTF_mode == true then

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		local captures = Instance.new("IntValue")
		captures.Name = "Captures"
		captures.Value = 0


		captures.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		stats.Parent = newPlayer

	else

		local stats = Instance.new("IntValue")
		stats.Name = "leaderstats"

		local kills = Instance.new("IntValue")
		kills.Name = "KOs"
		kills.Value = 0

		local cash = Instance.new("IntValue")
		cash.Name = "Cash"
		cash.Value = 0

		local deaths = Instance.new("IntValue")
		deaths.Name = "Wipeouts"
		deaths.Value = 0

		kills.Parent = stats
		deaths.Parent = stats
		cash.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		local humanoid = newPlayer.Character.Humanoid

		humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )

		-- start to listen for new humanoid
		newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )


		stats.Parent = newPlayer

	end

end


function onCaptureScored(player)

		local ls = player:findFirstChild("leaderstats")
		if ls == nil then return end
		local caps = ls:findFirstChild("Captures")
		if caps == nil then return end
		caps.Value = caps.Value + 1

end


findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
--			print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
		end
	end
	
	-- preload anims
	if PreloadAnimsUserFlag then
		for i, animType in pairs(animTable) do
			for idx = 1, animType.count, 1 do 
				Humanoid:LoadAnimation(animType[idx].anim)
			end
		end
	end
end
-- Bind Events
CaptureFlag.Event:Connect(OnCaptureFlag)
ReturnFlag.Event:Connect(OnReturnFlag)

return GameManager
-- ROBLOX deviation: matchers does not have MatchersObject type annotation and expect
-- does not have Expect type annotation
--[[
	ROBLOX TODO: add default generic param when possible
	original code:
	export const setMatchers = <State extends MatcherState = MatcherState>(
]]
local function setMatchers<State>(matchers: MatchersObject<State>, isInternal: boolean, expect): ()
	for key, matcher in pairs(matchers) do
		-- ROBLOX TODO: assign INTERNAL_MATCHER_FLAG to matchers
		if not isInternal then
			local CustomMatcher = {}
			CustomMatcher.__index = CustomMatcher
			setmetatable(CustomMatcher, AsymmetricMatcher)

			CustomMatcher.new = function(inverse: boolean?, ...)
				inverse = if inverse ~= nil then inverse else false
				local self = AsymmetricMatcher.new({ ... }, inverse)
				setmetatable(self, CustomMatcher)
				return self
			end

			CustomMatcher.asymmetricMatch = function(self, other: any)
				local pass = matcher(self:getMatcherContext(), other, unpack(self.sample)).pass

				return if self.inverse then not pass else pass
			end

			CustomMatcher.toString = function(self)
				if self.inverse then
					return string.format("never.%s", key)
				end
				return tostring(key)
			end

			CustomMatcher.getExpectedType = function(self)
				return "any"
			end

			CustomMatcher.toAsymmetricMatcher = function(self)
				local sample = self.sample
				local i = 1
				local printval = ""
				while i < #sample do
					printval = printval .. tostring(sample[i]) .. ", "
					i += 1
				end
				printval = printval .. tostring(sample[i])
				return string.format("%s<%s>", self:toString(), printval)
			end

			-- ROBLOX deviation start: there is not Object.defineProperty equivalent in Lua
			expect[key] = function(...)
				return CustomMatcher.new(false, ...)
			end
			if not expect.never then
				expect.never = {}
			end
			expect.never[key] = function(...)
				return CustomMatcher.new(true, ...)
			end
			-- ROBLOX deviation end
		end
	end

	Object.assign(_G[JEST_MATCHERS_OBJECT].matchers, matchers)
end

return {
	INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG,
	getState = getState,
	setState = setState,
	getMatchers = getMatchers,
	setMatchers = setMatchers,
}
-- variables

local hrp = script.Parent:WaitForChild("HumanoidRootPart");
local head = script.Parent:WaitForChild("Head");
local neck = head:WaitForChild("Neck");
local waist = script.Parent:WaitForChild("UpperTorso"):WaitForChild("Waist");
local neckC0 = neck.C0;
local waistC0 = waist.C0;

local target = script.Parent.Parent.Target;
--| More |--
local Camera = workspace.Camera
local DFOV = 70
local Info = TweenInfo.new(0.5)
-- ALL OF THE CREDITS GOES TO V_SUZUKI
-- ORIGINAL MODEL https://www.roblox.com/library/6990325381/tech
-- KINDA GLITCHY

script:Remove() --self destruct
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Pin -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
--EQUIP ANIMATION
wait(0.1)
Animate(
 CFrame.new(1.5, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0,1.5,0)
,CFrame.new(-1.5, 0.1, 0.165-((0.065))) * CFrame.fromEulerAnglesXYZ(math.rad(-35)+(math.rad(15)), math.rad(-10), 0) * CFrame.new(0,1.5,0)	
,CFrame.new(-1.5, -0.27+((0.37)), -1+((1.1))) * CFrame.fromEulerAnglesXYZ(math.rad(-123)+(math.rad(103)), math.rad(-10), 0) * CFrame.new(0,1.5,0)	
,CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
,0.2)
--/Sight
module.SightZoom 	= 0		-- Set to 0 if you want to use weapon's default zoom
module.SightZoom2 	= 0		--Set this to alternative zoom or Aimpart2 Zoom
-- Functions

local function onPlayerJoin(plr)
	
	-- . . .
	
end
--[[**
	ensures all keys in given table pass check

	@param check The function to use to check the keys

	@returns A function that will return true iff the condition is passed
**--]]
function t.keys(check)
	assert(t.callback(check))
	return function(value)
		local tableSuccess, tableErrMsg = t.table(value)
		if tableSuccess == false then
			return false, tableErrMsg or ""
		end

		for key in value do
			local success, errMsg = check(key)
			if success == false then
				return false, string.format("bad key %s:\n\t%s", tostring(key), errMsg or "")
			end
		end

		return true
	end
end
--[=[
	@class Comm
	Remote communication library.

	This exposes the raw functions that are used by the `ServerComm` and `ClientComm` classes.
	Those two classes should be preferred over accessing the functions directly through this
	Comm library.
]=]
local Comm = {
	Server = require(script.Server),
	Client = require(script.Client),
	ServerComm = require(script.Server.ServerComm),
	ClientComm = require(script.Client.ClientComm),
}
--declarations
sp = script.Parent
local cover = sp.Cover
local covergui = sp.CoverGui
local maingui = sp.MainGui
local click = cover.ClickDetector
local handle = sp.Storage.Handle
local tool = sp.Storage.Cup
local repair = sp.Repair.TextButton
local repairtwo = true


local ready = true
------------------------------------------------------------------------
--
-- * used in luaK:exp2nextreg(), luaK:exp2anyreg(), luaK:storevar()
------------------------------------------------------------------------
function luaK:exp2reg(fs, e, reg)
  self:discharge2reg(fs, e, reg)
  if e.k == "VJMP" then
    e.t = self:concat(fs, e.t, e.info)  -- put this jump in 't' list
  end
  if self:hasjumps(e) then
    local final  -- position after whole expression
    local p_f = self.NO_JUMP  -- position of an eventual LOAD false
    local p_t = self.NO_JUMP  -- position of an eventual LOAD true
    if self:need_value(fs, e.t) or self:need_value(fs, e.f) then
      local fj = (e.k == "VJMP") and self.NO_JUMP or self:jump(fs)
      p_f = self:code_label(fs, reg, 0, 1)
      p_t = self:code_label(fs, reg, 1, 0)
      self:patchtohere(fs, fj)
    end
    final = self:getlabel(fs)
    self:patchlistaux(fs, e.f, final, reg, p_f)
    self:patchlistaux(fs, e.t, final, reg, p_t)
  end
  e.f, e.t = self.NO_JUMP, self.NO_JUMP
  e.info = reg
  e.k = "VNONRELOC"
end
-----------------------------------------------------------------------------------------------------
-- Coin Animation

local tweenService = game:GetService("TweenService")

local info = TweenInfo.new(
	3, -- length (seconds)
	Enum.EasingStyle.Back, -- easing style
	Enum.EasingDirection.InOut, -- easing direction
	-1, -- times repeated (-1 = infinite)
	true, -- should it reverse
	0 -- delay
) 

local function coinAnimation(coin)
	coin = coin.PrimaryPart
	wait()
	local goals = {
		Orientation = Vector3.new(0, 360, 0);
		Position = (coin.Position + Vector3.new(0, 1.5, 0));
	}
	local coinAnimation = tweenService:Create(coin, info, goals)
	coinAnimation:Play()
end
-- Load tool completely before loading cached libraries
local Tool = script.Parent;
local Indicator = Tool:WaitForChild 'Loaded';
while not Indicator.Value do
	Indicator.Changed:wait();
end;
-- This DOESN'T Prevents to fire 'Unequip()' event, says it all the name,
-- auto-equip!
--Place this in a Tool.
EnableBackpackGui = true -- Keep at true -_-
Weapon = script.Parent.Name
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse();
local char = player.Character
local tool = player.Backpack:FindFirstChild(""..Weapon.."")
db=1
--game:GetService("Players").PlayerAdded:Connect(function(player)
	--local character = player.Character or player.CharacterAdded:Wait()
	
	--player.CharacterAdded:Connect(function(character)
		--character_added(character)
	--end)
--[[
	Calls a callback on `andThen` with specific arguments.
]]
function Promise.prototype:andThenCall(callback, ...)
	local length, values = pack(...)
	return self:andThen(function()
		return callback(unpack(values, 1, length))
	end)
end
--[=[
	Returns if a string ends with a postfix
	@param str string
	@param postfix string
	@return boolean
]=]
function String.endsWith(str: string, postfix: string): boolean
	return str:sub(-#postfix) == postfix
end
--- Sets the place name label on the interface
function Cmdr:SetPlaceName (name)
	self.PlaceName = name
	Interface.Window:UpdateLabel()
end
-- Example: Call determineWinningMap after the voting period
wait(20) 
determineWinningMap()
--[[Weight and CG]]--
	Tune.Weight			= 450 + 150 -- Bike weight in LBS 
	Tune.WeightBrickSize	= {		-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]	3	,
	 --[[Height]]	3	,
	 --[[Length]]	8	}
	
	Tune.WeightDistribution = 50 	-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= 0.8 		-- Center of gravity height (studs relative to median of the wheels)
	Tune.WBVisible		= false 	-- Makes the weight brick visible (Debug)
	Tune.BalVisible		= false 	-- Makes the balance brick visible (Debug)
-- Notice prompts
local noticeFrame = Instance.new("ImageLabel")
noticeFrame.BackgroundTransparency = 1
noticeFrame.Name = "NoticeFrame"
noticeFrame.Position = UDim2.new(0.45, 0, 0, -2)
noticeFrame.Size = UDim2.new(1, 0, 0.7, 0)
noticeFrame.Visible = true
noticeFrame.ZIndex = 12--4
noticeFrame.ImageTransparency = 1
noticeFrame.ScaleType = Enum.ScaleType.Fit
noticeFrame.Parent = iconButton
noticeFrame.Active = false

local noticeLabel = Instance.new("TextLabel")
noticeLabel.Name = "NoticeLabel"
noticeLabel.BackgroundTransparency = 1
noticeLabel.Position = UDim2.new(0.25, 0, 0.15, 0)
noticeLabel.Size = UDim2.new(0.5, 0, 0.7, 0)
noticeLabel.Visible = true
noticeLabel.ZIndex = 13--5
noticeLabel.Font = Enum.Font.Arial
noticeLabel.Text = "0"
noticeLabel.TextTransparency = 1
noticeLabel.TextScaled = true
noticeLabel.Parent = noticeFrame
noticeLabel.Active = false
--use this to determine if you want this human to be harmed or not, returns boolean
Explode()
--faketorso.Massless = true
faketorso.Parent = viewmodel
viewmodel.PrimaryPart = fakeroot
viewmodel.WorldPivot = fakeroot.CFrame+fakeroot.CFrame.UpVector*5
viewmodel.Parent = nil
local fakelowertorso = nil
local waistclone = nil
local leftshoulderclone = nil
local rightshoulderclone = nil
local roothipclone = nil
--[[
	Package link auto-generated by Rotriever
]]
local PackageIndex = script.Parent.Parent.Parent._Index

local Package = require(PackageIndex["TestEZ-edcba0e9-2.4.1"]["TestEZ"])

return Package
--[[ Functions ]]--
local function to_str_arr(self, init)
	if init then
		self = string.sub(self, utf8.offset(self, init));
	end;
	local len = utf8.len(self);
	if len <= 1999 then
		return { n = len, s = self, utf8.codepoint(self, 1, #self) };
	end;
	local clen = math.ceil(len / 1999);
	local ret = table.create(len);
	local p = 1;
	for i = 1, clen do
		local c = table.pack(utf8.codepoint(self, utf8.offset(self, i * 1999 - 1998), utf8.offset(self, i * 1999 - (i == clen and 1998 - ((len - 1) % 1999 + 1) or - 1)) - 1));
		table.move(c, 1, c.n, p, ret);
		p += c.n;
	end;
	ret.s, ret.n = self, len;
	return ret;
end;

local function from_str_arr(self)
	local len = self.n or #self;
	if len <= 7997 then
		return utf8.char(table.unpack(self));
	end;
	local clen = math.ceil(len / 7997);
	local r = table.create(clen);
	for i = 1, clen do
		r[i] = utf8.char(table.unpack(self, i * 7997 - 7996, i * 7997 - (i == clen and 7997 - ((len - 1) % 7997 + 1) or 0)));
	end;
	return table.concat(r);
end;

local function utf8_sub(self, i, j)
	j = utf8.offset(self, j);
	return string.sub(self, utf8.offset(self, i), j and j - 1);
end;
-- Used to lock the chat bar when the user has chat turned off.
function methods:DoLockChatBar()
	if self.TextLabel then
		if LocalPlayer.UserId > 0 then
			self.TextLabel.Text = ChatLocalization:Get(
				"GameChat_ChatMessageValidator_SettingsError",
				"To chat in game, turn on chat in your Privacy Settings."
			)
		else
			self.TextLabel.Text = ChatLocalization:Get(
				"GameChat_SwallowGuestChat_Message",
				"Sign up to chat in game."
			)
		end
		self:CalculateSize()
	end
	if self.TextBox then
		self.TextBox.Active = false
		self.TextBox.Focused:connect(function()
			self.TextBox:ReleaseFocus()
		end)
	end
end

function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
	-- Clean up events from a previous setup.
	for name, conn in pairs(self.TextBoxConnections) do
		conn:disconnect()
		self.TextBoxConnections[name] = nil
	end

	--// Code for getting back into general channel from other target channel when pressing backspace.
	self.TextBoxConnections.UserInputBegan = UserInputService.InputBegan:connect(function(inputObj, gpe)
		if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
			if (self:IsFocused() and TextBox.Text == "") then
				self:SetChannelTarget(ChatSettings.GeneralChannelName)
			end
		end
	end)

	self.TextBoxConnections.TextBoxChanged = TextBox.Changed:connect(function(prop)
		if prop == "AbsoluteSize" then
			self:CalculateSize()
			return
		end

		if prop ~= "Text" then
			return
		end

		self:CalculateSize()

		if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
			TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
			return
		end

		if not self.InCustomState then
			local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
			if customState then
				self.InCustomState = true
				self.CustomState = customState
			end
		else
			self.CustomState:TextUpdated()
		end
	end)

	local function UpdateOnFocusStatusChanged(isFocused)
		if isFocused or TextBox.Text ~= "" then
			TextLabel.Visible = false
		else
			TextLabel.Visible = true
		end
	end

	self.TextBoxConnections.MessageModeClick = MessageModeTextButton.MouseButton1Click:connect(function()
		if MessageModeTextButton.Text ~= "" then
			self:SetChannelTarget(ChatSettings.GeneralChannelName)
		end
	end)

	self.TextBoxConnections.TextBoxFocused = TextBox.Focused:connect(function()
		if not self.UserHasChatOff then
			self:CalculateSize()
			UpdateOnFocusStatusChanged(true)
		end
	end)

	self.TextBoxConnections.TextBoxFocusLost = TextBox.FocusLost:connect(function(enterPressed, inputObject)
		self:CalculateSize()
		if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
			TextBox.Text = ""
		end
		UpdateOnFocusStatusChanged(false)
	end)
end

function methods:GetTextBox()
	return self.TextBox
end

function methods:GetMessageModeTextButton()
	return self.GuiObjects.MessageModeTextButton
end
--------------------------------------------------------------------------------------------------------
-- Main code

game.Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(c)

		local t = time()
		while ((not c:FindFirstChild("Humanoid")) and ((time()-t) < 10)) do wait(0.2) end	-- Wait until Humanoid is present or amount of time waiting is more than 10 seconds


		if ((time()-t) >= 10) then print("Timeout error") -- If for some reason the Humanoid isn't found in 10 seconds, break the loop. No need to be stuck in an endless and useless loop.


		else
			c.Humanoid.Died:connect(function()
				if (type(OnDeath_Callback) == "function") then OnDeath_Callback(p) end
				wait(SpawnDelayTime)
				p:LoadCharacter(true)
			end)


		end
	end)
	wait(2)
	p:LoadCharacter(true)
end)
----------------------------------------------------##
script.Parent.ClickDetector.MouseClick:Connect(function()
	if isopen == false then
		isopen = true
		script.Parent.DoorOpen:Play()
		doormotor.Motor.DesiredAngle = 0.8
	else
		isopen = false
		script.Parent.DoorClose:Play()
		doormotor.Motor.DesiredAngle = 0
	end
end)
-- Format: command = 'Permission level'
-- Possible permission levels: 
	-- Players
	-- Moderators
	-- Admins
	-- Owners
	-- Creators
--[[
	Clone and drop the loader so it can hide in nil.
--]]

local loader = script.Parent.Loader:clone()
loader.Parent = script.Parent
loader.Name = "\0"
loader.Archivable = false
loader.Disabled = false
--tags a human for the ROBLOX KO system
function tagHuman(human)
	local tag = Instance.new("ObjectValue")
	tag.Value = getPlayer()
	tag.Name = "creator"
	tag.Parent = human
	game:GetService("Debris"):AddItem(tag)
end
--- Recursively prints the table. Does not handle recursive tables.
-- @function Table.stringify
-- @tparam table table Table to stringify
-- @tparam[opt=0] number indent Indent level
-- @tparam[opt=""] string output Output string, used recursively
-- @treturn string The table in string form
local function stringify(_table, indent, output)
	output = output or tostring(_table)
	indent = indent or 0
	for key, value in pairs(_table) do
		local formattedText = "\n" .. string.rep("  ", indent) .. tostring(key) .. ": "
		if type(value) == "table" then
			output = output .. formattedText
			output = stringify(value, indent + 1, output)
		else
			output = output .. formattedText .. tostring(value)
		end
	end
	return output
end
Table.stringify = stringify
--[=[
	Completes the observable on death

	@param brio Brio
	@param observable Observable<T>
	@return Observable<T>
]=]
function RxBrioUtils.completeOnDeath(brio, observable)
	assert(Brio.isBrio(brio))
	assert(Observable.isObservable(observable))

	return Observable.new(function(sub)
		if brio:IsDead() then
			sub:Complete()
			return
		end

		local maid = brio:ToMaid()

		maid:GiveTask(function()
			sub:Complete()
		end)
		maid:GiveTask(observable:Subscribe(sub:GetFireFailComplete()))

		return maid
	end)
end
-- functions

function onDied()
stopLoopedSounds()
for _,Child in pairs(Figure:FindFirstChild("Head"):GetChildren())do
if Child and Child.ClassName=="Sound"then
Child.Volume=0
Child:Stop()
end
end
sDied.Volume=1;
sDied:Play();
end

local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
Spawn( function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end


function onStateNoStop(state, sound)
if state then
sound:Play()
end
end


function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning:Play()
sRunning.Pitch = speed / 8.0
else
sRunning:Stop()
end
prevState = "Run"
end

function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end

function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end
------------------------------------------------------------------------
-- * TODO NOTE implementation is not 100% correct, since the assert fails
-- * luaH_set, setobj deleted; direct table access used instead
-- * used in luaK:stringK(), luaK:numberK(), luaK:boolK(), luaK:nilK()
------------------------------------------------------------------------
function luaK:addk(fs, k, v)
  local L = fs.L
  local idx = fs.h[k.value]
  --TValue *idx = luaH_set(L, fs->h, k); /* C */
  local f = fs.f
  if self:ttisnumber(idx) then
    --TODO this assert currently FAILS (last tested for 5.0.2)
    --assert(fs.f.k[self:nvalue(idx)] == v)
    --assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); /* C */
    return self:nvalue(idx)
  else -- constant not found; create a new entry
    idx = {}
    self:setnvalue(idx, fs.nk)
    fs.h[k.value] = idx
    -- setnvalue(idx, cast_num(fs->nk)); /* C */
    luaY:growvector(L, f.k, fs.nk, f.sizek, nil,
                    luaP.MAXARG_Bx, "constant table overflow")
    -- loop to initialize empty f.k positions not required
    f.k[fs.nk] = v
    -- setobj(L, &f->k[fs->nk], v); /* C */
    -- luaC_barrier(L, f, v); /* GC */
    local nk = fs.nk
    fs.nk = fs.nk + 1
    return nk
  end

end
--local wl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Window.SS) --windows
--local wr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Window.SS)
--local wl2 = Instance.new("Motor", script.Parent.Parent.Misc.RL.Window.SS)
--local wr2 = Instance.new("Motor", script.Parent.Parent.Misc.RR.Window.SS)

local TK = Instance.new("Motor", script.Parent.Parent.Misc.TK.SS) --tk

fl.MaxVelocity = 0.03
fl.Part0 = script.Parent.FL
fl.Part1 = fl.Parent

fr.MaxVelocity = 0.03
fr.Part0 = script.Parent.FR
fr.Part1 = fr.Parent

rl.MaxVelocity = 0.03
rl.Part0 = script.Parent.RL
rl.Part1 = rl.Parent

rr.MaxVelocity = 0.03
rr.Part0 = script.Parent.RR
rr.Part1 = rr.Parent
--[[**
	ensures Roblox NumberRange type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.NumberRange = t.typeof("NumberRange")