Pinkstack/roblox-luau-corpus-text huggingface dataset:
--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.Snowball-- 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)
-- Ring5 descending


for l = 1,#lifts5 do
	if (lifts5[l].className == "Part") then
	lifts5[l].BodyPosition.position = Vector3.new((lifts5[l].BodyPosition.position.x),(lifts5[l].BodyPosition.position.y-8),(lifts5[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts5 do
	parts5[p].CanCollide = false
end
wait(0.1)

wait(1)
localdeb.Value = false
foreigndeb.Value = false

end
end

script.Parent.Touched:connect(onTouched)
--!strict


local function slice(str: string, startIndexStr: string | number, lastIndexStr: (string | number)?): string
	local strLen, invalidBytePosition = utf8.len(str)
	assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
	local startIndex = tonumber(startIndexStr)
	assert(typeof(startIndex) == "number", "startIndexStr should be a number")

	if startIndex + strLen < 0 then
		-- then |start index| is greater than string length
		startIndex = 1
	end

	if startIndex > strLen then
		return ""
	end

	-- if no last index length set, go to str length + 1
	local lastIndex = strLen + 1
	if lastIndexStr ~= nil then
		-- ROBLOX FIXME: add parseInt to encapsulate this logic and use it here
		local NaN = 0 / 0
		lastIndex = tonumber(lastIndexStr) or NaN -- this works because 0 is truthy in Lua
	end
	assert(typeof(lastIndex) == "number", "lastIndexStr should convert to number")

	if lastIndex > strLen then
		lastIndex = strLen + 1
	end

	local startIndexByte = utf8.offset(str, startIndex)
	-- get char length of charset retunred at offset
	local lastIndexByte = utf8.offset(str, lastIndex) - 1

	return string.sub(str, startIndexByte, lastIndexByte)
end

return slice
--[[Transmission]]


	Tune.TransModes		= {"Auto", "Semi"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "Manual"}								
		>First mode is default mode													]]
	
	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]	
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)
	
	--Gear Ratios
	Tune.FinalDrive		= 3.06			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		3.53		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.04		,
		--[[ 3 ]]		1.38		,
		--[[ 4 ]]		1.03		,
		--[[ 5 ]]		0.81		,
		--[[ 6 ]]		0.64		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
------- extreme math equations


		local v = 30
		local c = 50
		local m = part:GetMass()
		if m< 20 then
			m = 20
		end
		part.RotVelocity =Vector3.new(math.random(-v,v)/(m/c),math.random(-v,v)/(m/c),math.random(-v,v)/(m/c))
		game:GetService("Debris"):AddItem(script.Parent,0.1)--penetration
	
	end
	local a = part.Parent:findFirstChild("Humanoid")
	local b = part.Parent.Parent:findFirstChild("Humanoid")
		local debrispart = Instance.new("Part")
		debrispart.Name="debrispart"
		debrispart.Size = Vector3.new(0.05,0.05,0.05)
		debrispart.BrickColor = part.BrickColor
		debrispart.Anchored=true
		debrispart.CanCollide = false
		debrispart.Transparency=1
		debrispart.Position=positiono
		debrispart.Parent=game.Workspace
		if a == nil and b == nil then
		local thingy = script.debris:Clone()
		thingy.Color=ColorSequence.new(part.Color,part.Color)
		thingy.Parent=debrispart
		spawn(function()
		thingy:Emit(10)
		end)
		end
		if a ~= nil or b ~= nil then
		local thingy = script.blood:Clone()
		thingy.Parent=debrispart
		spawn(function()
		thingy:Emit(10)
		end)
		end
		game:GetService("Debris"):AddItem(debrispart,1)
		game:GetService("Debris"):AddItem(script.Parent,0.05)
		
	--[[if position ~= nil then
	end]]--
	end
end

	script.Parent.Touched:connect(hit)
--	for i=1,3 do
--		local s = Instance.new("Part")
--		s.Shape = 1 -- block
--		s.formFactor = 2 -- plate
--		s.Size = Vector3.new(1,.4,1)
--		s.BrickColor = ball.BrickColor
--		local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1))
--		s.Velocity = 15 * v
--		s.CFrame = CFrame.new(ball.Position + v, v)
--		ball.BrickCleanup:clone().Parent = s
--		s.BrickCleanup.Disabled = false
--		s.Parent = game.Workspace
--R6


MakeWeld(car.Misc.Anims.R6.RightArm.Z,car.Misc.Anims.R6.RightArm.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightArm.Y,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.RightArm.Parts,misc.Anims.R6.RightArm.Z)
MakeWeld(car.Misc.Anims.R6.LeftArm.Z,car.Misc.Anims.R6.LeftArm.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.LeftArm.Y,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.LeftArm.Parts,misc.Anims.R6.LeftArm.Z)

MakeWeld(car.Misc.Anims.R6.LeftLeg.X,car.Misc.Anims.R6.LeftLeg.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.LeftLeg.Z,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.LeftLeg.Parts,misc.Anims.R6.LeftLeg.X)

MakeWeld(car.Misc.Anims.R6.RightLeg.X,car.Misc.Anims.R6.RightLeg.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightLeg.Z,car.Misc.Anims.R6.RightLeg.I,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.RightLeg.I,car.DriveSeat,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.RightLeg.Parts,misc.Anims.R6.RightLeg.X)

MakeWeld(car.Misc.Anims.R6.Torso.Z,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Torso.X,car.Misc.Anims.R6.Torso.Z,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.Torso.Parts,misc.Anims.R6.Torso.X)

MakeWeld(car.Misc.Anims.R6.Head.X,car.Misc.Anims.R6.Head.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Head.Y,car.Misc.Anims.R6.Head.Z,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R6.Head.Z,car.Misc.Anims.R6.Torso.X,"Motor6D").Name="M"
ModelWeld(misc.Anims.R6.Head.Parts,misc.Anims.R6.Head.X)
-----------------------------------------------------------------------------



script.Parent.Humanoid.HealthChanged:Connect(function()
	if script.Parent.Humanoid.Health <= 37 then
		
		Instance.new("Decal", script.Parent.Head)
		script.Parent.Head.Decal.Texture = "rbxassetid://176678128"
		script.Parent.Head.Decal.Face = "Front"
	end
end)
--[[Brakes]]


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

	Tune.FBrakeForce	= 3000		-- Front brake force
	Tune.RBrakeForce	= 2500		-- Rear brake force
	Tune.PBrakeForce	= 99999		-- Handbrake force
	
	Tune.FLgcyBForce	= 41000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 36000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 150000    -- Handbrake force [PGS OFF]
--local Text = thirstGui:WaitForChild("Back"):WaitForchild("Text")


local plr = game.Players.LocalPlayer

repeat wait() until plr.Character -- waiting for player to load

local UIS = game:GetService("UserInputService")
local hum = plr.Character:WaitForChild("Humanoid")
local maxThirst = 100
local maxHunger = 100
local thirstValue
local hungerValue

if plr:FindFirstChild("HungerVal") then
	hungerValue = plr.HungerVal
	hungerValue.Value = maxHunger
else
	Instance.new("IntValue", plr).Name = "HungerVal"
	plr.HungerVal.Value = maxHunger
	hungerValue = plr.HungerVal
end

if plr:FindFirstChild("ThirstVal") then
	thirstValue = plr.ThirstVal
	thirstValue.Value = maxThirst
else
	Instance.new("IntValue", plr).Name = "ThirstVal"
	plr.ThirstVal.Value = maxThirst
	thirstValue = plr.ThirstVal
end

local hungerValue = plr:WaitForChild("HungerVal")
local Frame = thirstGui.Frame

local TS = game:GetService("TweenService")

thirstValue.Changed:connect(function()



	if thirstValue.Value > 60 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
	elseif thirstValue.Value <= 0 then
		MedicSys.Fome:FireServer()
	elseif thirstValue.Value <= 30 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((thirstValue.Value/30)*255),((thirstValue.Value/60)*255)),ImageTransparency = 0}):Play()
	elseif thirstValue.Value <= 60 then
		TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((thirstValue.Value/60)*255)),ImageTransparency = 0}):Play()
	end
end)


hungerValue.Changed:connect(function()

	if hungerValue.Value > 60 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
	elseif hungerValue.Value <= 0 then
		MedicSys.Fome:FireServer()
	elseif hungerValue.Value <= 30 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((hungerValue.Value/30)*255),((hungerValue.Value/60)*255)),ImageTransparency = 0}):Play()
	elseif hungerValue.Value <= 60 then
		TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((hungerValue.Value/60)*255)),ImageTransparency = 0}):Play()
	end
end)


while wait(ServerConfig.HungerWaitTime) do

	if thirstValue.Value - 1 >= 0 then
		thirstValue.Value = thirstValue.Value - 1
	end

	if hungerValue.Value - 1 >= 0 then
		hungerValue.Value = hungerValue.Value - 1
	end
	
end
-- Show highlight on currently equipped tool in toolbar


EquippedVal.Changed:connect(function()
	for i,v in pairs(UiFrame:GetChildren()) do
		if v:IsA('ImageButton') then
			v.BorderSizePixel = 1
		end
	end
	if EquippedVal.Value then
		local imageButton = UiFrame:FindFirstChild(EquippedVal.Value.Name)
		if imageButton then
			imageButton.BorderSizePixel = 4
		end
	end
end)

for i,v in pairs(UiFrame:GetChildren()) do
	if v:IsA("ImageButton") then
		v.MouseButton1Click:Connect(function()
			local slotRequested = SlotsFolder:FindFirstChild(v.Name)
				if slotRequested then -- if there is such a slot
					-- if they're requesting the same slot
					if EquippedVal.Value == slotRequested then 
						EquippedVal.Value = nil -- unequip the tool
					else
						EquippedVal.Value = slotRequested -- equip the tool
					end
				end
		end)
	end
end

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--[ FUNCTIONS ]--



if not AFKEvent then
	AFKEvent = Instance.new("RemoteEvent")
	AFKEvent.Parent = game.ReplicatedStorage
	AFKEvent.Name = "AFK"
end

local updateAFK = function(player,enable)
	
	local GUI = player.Character:WaitForChild("HumanoidRootPart"):WaitForChild("OverheadGui")
	local AFKTagT = GUI:WaitForChild("Username")
	
	if enable then
		AFKTagT.Text = "AFK | "..player.Name.." (@"..player.DisplayName..")"
	else
		AFKTagT.Text = player.Name.." (@"..player.DisplayName..")"
	end
end


AFKEvent.OnServerEvent:Connect(function(player,enable)
	AFKStatus[player] = enable
	updateAFK(player,enable)
end)
--[=[
	Connects a handler to a ScriptSignal object, but only allows that
	connection to run once. Any `:Fire` calls called afterwards won't trigger anything.

	```lua
	ScriptSignal:ConnectOnce(function()
		print("Connection fired")
	end)

	ScriptSignal:Fire()
	ScriptSignal:Fire()

	-- "Connection fired" is only fired once
	```

	@param handler (...: any) -> ()
	@ignore
]=]


function ScriptSignal:ConnectOnce(
	handler: (...any) -> ()
)
	assert(
		typeof(handler) == 'function',
		"Must be function"
	)

	local connection
	connection = self:Connect(function(...)
		connection:Disconnect()
		handler(...)
	end)
end
-- Functions



local function getRotationBetween(u, v, axis)
	local dot, uxv = u:Dot(v), u:Cross(v)
	if (dot < -0.99999) then return CFrame.fromAxisAngle(axis, math.pi) end
	return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


local function BoostSetup()	
	local Speedometer = gui:WaitForChild("Speedometer")
	local Bar = Speedometer:WaitForChild("Bar")
	local SpeedBar = Bar:WaitForChild("SpeedBar")

	function GuiController:UpdateBoost(boostAmount)
		local boostPercentage = math.clamp(boostAmount/engine._settings.BoostAmount, 0, 1)
		Bar.Position = UDim2.new(-1 + boostPercentage, 0, 0, 0)
		SpeedBar.Position = UDim2.new(1 - 1*boostPercentage, 0, 0, 0)
	end
end -- BoostSetup()
--[[ Roblox Services ]]

--
local UserInputService = game:GetService("UserInputService")
local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local DebrisService = game:GetService('Debris')
local StarterGui = game:GetService("StarterGui")
local Workspace = game:GetService("Workspace")
local CollectionService = game:GetService("CollectionService")
local GuiService = game:GetService("GuiService")
-- Buy case #1



BuyCasesEvents.Case1.OnServerEvent:Connect(function(player, PricePoints, PriceGems, PointsBuy)
	if PointsBuy == true then
		if player.DataFolder.Points.Value >= PricePoints then
			player.DataFolder.Points.Value -= PricePoints
			print(PricePoints)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Choose the case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end
	elseif PointsBuy == false then
		if player.DataFolder.Gems.Value >= PriceGems then
			player.DataFolder.Gems.Value -= PriceGems
			print(PriceGems)
			--Transaction Completed
			player.Inventory.BatCase1.Value += 1 --Case
		else
			MessagesEvents.NotEnoughPoints:FireClient(player)
		end

	end
end)

OpenCasesEvents.OpenCase1.OnServerEvent:Connect(function(player)
	if player.Inventory.BatCase1.Value > 0 then
		player.Inventory.BatCase1.Value -= 1
		OpenCasesEvents.OpenCase1:FireClient(player)
	else
		MessagesEvents.CaseNotOwned:FireClient(player)
	end
end)
--////////////////////////////////////////////////////////////////////////////////////////////
--///////////////////////////////////////////////// Code to hook client UI up to server events
--////////////////////////////////////////////////////////////////////////////////////////////



function DoChatBarFocus()
	if (not ChatWindow:GetCoreGuiEnabled()) then return end
	if (not ChatBar:GetEnabled()) then return end

	if (not ChatBar:IsFocused() and ChatBar:GetVisible()) then
		moduleApiTable:SetVisible(true)
		InstantFadeIn()
		ChatBar:CaptureFocus()
		moduleApiTable.ChatBarFocusChanged:fire(true)
	end
end

chatBarFocusChanged.Event:connect(function(focused)
	moduleApiTable.ChatBarFocusChanged:fire(focused)
end)

function DoSwitchCurrentChannel(targetChannel)
	if (ChatWindow:GetChannel(targetChannel)) then
		ChatWindow:SwitchCurrentChannel(targetChannel)
	end
end

function SendMessageToSelfInTargetChannel(message, channelName, extraData)
	local channelObj = ChatWindow:GetChannel(channelName)
	if (channelObj) then
		local messageData =
		{
			ID = -1,
			FromSpeaker = nil,
			SpeakerUserId = 0,
			OriginalChannel = channelName,
			IsFiltered = true,
			MessageLength = string.len(message),
			MessageLengthUtf8 = utf8.len(utf8.nfcnormalize(message)),
			Message = trimTrailingSpaces(message),
			MessageType = ChatConstants.MessageTypeSystem,
			Time = os.time(),
			ExtraData = extraData,
		}

		channelObj:AddMessageToChannel(messageData)
	end
end

function chatBarFocused()
	if (not mouseIsInWindow) then
		DoBackgroundFadeIn()
		if (textIsFaded) then
			DoTextFadeIn()
		end
	end

	chatBarFocusChanged:Fire(true)
end
-- initialize to idle


playAnimation("idle", 0.1, Humanoid)
pose = "Standing"

function populatehumanoids(mdl)
	if mdl.ClassName=="Humanoid" then
		table.insert(humanoids,mdl)
	end
	for i2,mdl2 in ipairs(mdl:GetChildren()) do
		populatehumanoids(mdl2)
	end
end

while Figure.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Figure.Head and Torso~=nil and Torso.Parent~=nil do
	local _,time=wait(0.1)
	humanoids={}
	populatehumanoids(game.Workspace)
	closesttarget=nil
	closestdist=sightrange
	local creator=Figure:FindFirstChild("creator")
	for i,h in ipairs(humanoids) do
		if h and h.Parent~=nil then
			if h.Health>0 and h.Parent.Name~=Figure.Name and h.Parent~=Figure then
				local plr=game.Players:GetPlayerFromCharacter(h.Parent)
				if creator==nil or plr==nil or creator.Value~=plr then
					local t=h.Parent:FindFirstChild("Torso")
					if t~=nil then
						local dist=(t.Position-Torso.Position).magnitude
						if dist<closestdist then
							closestdist=dist
							closesttarget=t
						end
					end
				end
			end
		end
	end
	if closesttarget~=nil then
		if not chasing then
			chasing=true
			Figure.canAttack.Value=true
			Humanoid.WalkSpeed=runspeed
		end
		Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
		if math.random()<.5 then
			--attack(time,closesttarget.Position)
		end
	else
		if chasing then
			chasing=false
			Figure.canAttack.Value=false
			Humanoid.WalkSpeed=wonderspeed
		end
		if time>nextrandom then
			nextrandom=time+3+(math.random()*5)
			local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
			Humanoid:MoveTo(randompos,game.Workspace.Terrain)
		end
	end
	if time>nextjump then
		nextjump=time+7+(math.random()*5)
		Humanoid.Jump=true
	end
	--animate(time)
	move(time)
end

wait(4)
Figure:remove()
-- enable the viewmodel system


local function enableviewmodel()
	isfirstperson = true
	if viewmodel.Parent ~= workspace.CurrentCamera then
		viewmodel.Parent = workspace.CurrentCamera
	end
	if rigtype == "R15" then
		-- disable character joints, enable viewmodel joints
		rightshoulderclone.Enabled = true
		leftshoulderclone.Enabled = true
		-- disable real shoulders
		leftshoulder.Enabled = true
		rightshoulder.Enabled = true
		--
		rightshoulderclone.Part1 = rarm
		rightshoulderclone.Part0 = faketorso
		rightshoulderclone.Parent = faketorso
		--
		leftshoulderclone.Part1 = larm
		leftshoulderclone.Part0 = faketorso
		leftshoulderclone.Parent = faketorso
		--
		armtransparency = firstperson_arm_transparency
	else
		--
		rightshoulderclone.Enabled = true
		leftshoulderclone.Enabled = true
		-- disable real shoulders
		leftshoulder.Enabled = false
		rightshoulder.Enabled = false
		--
		rightshoulderclone.Part1 = rarm
		rightshoulderclone.Part0 = faketorso
		rightshoulderclone.Parent = faketorso
		--
		leftshoulderclone.Part1 = larm
		leftshoulderclone.Part0 = faketorso
		leftshoulderclone.Parent = faketorso
		
		--larm.Anchored = true
		--rarm.Anchored = true
		--
		armtransparency = firstperson_arm_transparency
	end
end
-- Waits for a new character to be added if the current one is invalid
-- (Ensures that you don't have the old dead character after a respawn)


function UTIL.WaitForValidCharacter(player)
	local character = player.Character
	if not character or not character.Parent or not character:FindFirstChild('Humanoid') or character.Humanoid.Health <= 0 then
		player.CharacterAdded:wait()
		wait(0) --NOTE: Necessary for server scripts executing on the same event
		character = player.Character
	end
	return character
end
------------------------------------------------------------------------------------------------------------



function configureAnimationSetOld(name, fileList)
	if (animTable[name] ~= nil) then
		for _, connection in pairs(animTable[name].connections) do
			connection:disconnect()
		end
	end
	animTable[name] = {}
	animTable[name].count = 0
	animTable[name].totalWeight = 0	
	animTable[name].connections = {}

	local allowCustomAnimations = true

	local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
	if not success then
		allowCustomAnimations = true
	end

	-- check for config values
	local config = script:FindFirstChild(name)
	if (allowCustomAnimations and config ~= nil) then
		table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
		table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
		local idx = 1
		for _, childPart in pairs(config:GetChildren()) do
			if (childPart:IsA("Animation")) then
				table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
				animTable[name][idx] = {}
				animTable[name][idx].anim = childPart
				local weightObject = childPart:FindFirstChild("Weight")
				if (weightObject == nil) then
					animTable[name][idx].weight = 1
				else
					animTable[name][idx].weight = weightObject.Value
				end
				animTable[name].count = animTable[name].count + 1
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
				idx = idx + 1
			end
		end
	end

	-- fallback to defaults
	if (animTable[name].count <= 0) then
		for idx, anim in pairs(fileList) do
			animTable[name][idx] = {}
			animTable[name][idx].anim = Instance.new("Animation")
			animTable[name][idx].anim.Name = name
			animTable[name][idx].anim.AnimationId = anim.id
			animTable[name][idx].weight = anim.weight
			animTable[name].count = animTable[name].count + 1
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
			-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
		end
	end

	-- preload anims
	for i, animType in pairs(animTable) do
		for idx = 1, animType.count, 1 do 
			Humanoid:LoadAnimation(animType[idx].anim)
		end
	end
end