Pinkstack/roblox-luau-corpus-text huggingface dataset:
----------------------------------------------------------------------


end


function computeLaunchAngle(dx,dy,grav)
	-- arcane
	-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
	
	local g = math.abs(grav)
	local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
	if inRoot <= 0 then
		return .25 * math.pi
	end
	local root = math.sqrt(inRoot)
	local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)

	local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
	local answer1 = math.atan(inATan1)
	local answer2 = math.atan(inATan2)
	if answer1 < answer2 then return answer1 end
	return answer2
end

function computeDirection(vec)
	local lenSquared = vec.magnitude * vec.magnitude
	local invSqrt = 1 / math.sqrt(lenSquared)
	return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end



Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		local bewl = script.Parent:FindFirstChild("Bool")
		if bewl then
			bewl:Destroy()
		end
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = humanoid.TargetPoint
	script.Parent.Handle.SlingshotSound:Play()
	fire(targetPos)


	Tool.Enabled = true
end


function onWeld()
local bewl = script.Parent:FindFirstChild("Bool")
	if bewl then
	bewl:Destroy()
	end

end
script.Parent.Activated:connect(onActivated)
script.Parent.Unequipped:connect(onWeld)
--//Const


local RS = game:GetService("RunService");

function ViewportInit:Init(VP, Selected, CamCFrame)
	if (not VP) then return; end

	VP:ClearAllChildren();
	
	local Obj = Selected:Clone();
	
	if (not Obj.PrimaryPart) then
		for i,v in pairs(Obj:GetChildren()) do
			if (v:IsA("BasePart")) then
				Obj.PrimaryPart = v;
				break;
			end
		end	
	end

	Obj:SetPrimaryPartCFrame(CFrame.new(Vector3.new(), CamCFrame.Position))
	Obj.Parent = VP;

	local Camera = Instance.new("Camera");
	VP.CurrentCamera = Camera;
	Camera.Parent = VP;

	local cf = CamCFrame
	Camera.CFrame = cf


	return Obj, Camera;
end

return ViewportInit
-- Private Functions



local function tripleProduct(a, b, c)
	return b * c:Dot(a) - a * c:Dot(b)
end

local function containsOrigin(self, simplex, direction)
	local a = simplex[#simplex]
	local ao = -a

	if (#simplex == 4) then
		local b, c, d = simplex[3], simplex[2], simplex[1]
		local ab, ac, ad = b - a, c - a, d - a
		local abc, acd, adb = ab:Cross(ac), ac:Cross(ad), ad:Cross(ab)
		
		abc = abc:Dot(ad) > 0 and -abc or abc
		acd = acd:Dot(ab) > 0 and -acd or acd
		adb = adb:Dot(ac) > 0 and -adb or adb
		
		if (abc:Dot(ao) > 0) then
			table.remove(simplex, 1)
			direction = abc
		elseif (acd:Dot(ao) > 0) then
			table.remove(simplex, 2)
			direction = acd
		elseif (adb:Dot(ao) > 0) then
			table.remove(simplex, 3)
			direction = adb
		else
			return true
		end
	elseif (#simplex == 3) then
		local b, c = simplex[2], simplex[1]
		local ab, ac = b - a, c - a
		
		local abc = ab:Cross(ac)
		local abPerp = tripleProduct(ac, ab, ab).Unit
		local acPerp = tripleProduct(ab, ac, ac).Unit
		
		if (abPerp:Dot(ao) > 0) then
			table.remove(simplex, 1)
			direction = abPerp
		elseif (acPerp:Dot(ao) > 0) then
			table.remove(simplex, 2)
			direction = acPerp
		else
			local isV3 = ((a - a) == ZERO3)
			if (not isV3) then
				return true
			else
				direction = abc:Dot(ao) > 0 and abc or -abc
			end
		end
	else
		local b = simplex[1]
		local ab = b - a
		local bcPerp = tripleProduct(ab, ao, ab).Unit
		direction = bcPerp
	end
	
	return false, direction
end
--[ LEADERSTATS  ]--



game.Players.PlayerAdded:Connect(function(player)
	
	local leaderstats = Instance.new("Folder", player) -- Creates a folder into the player
	leaderstats.Name = "leaderstats"
	
	local Clicks = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
	Clicks.Name = "Clicks"
	Clicks.Value = 0
	
	local Gems = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
	Gems.Name = "Gems"
	Gems.Value = 0
	
	local Rebirths = Instance.new("IntValue", leaderstats) -- Creates a value into the folder
	Rebirths.Name = "Rebirths"
	Rebirths.Value = 0
end)
--The button



script.Parent.Button.ClickDetector.MouseClick:connect(function(click)

if not (on) then on = true--On
    script.Parent.MeshPart.Transparency = 1
    script.Parent.MeshPart.CanCollide = false
elseif (on) then on = false --Off
    script.Parent.MeshPart.Transparency = 0
    script.Parent.MeshPart.CanCollide = true
    end
end)
-- fn cst_int_rdr(string src, int len, fn func)
-- @len - Length of type for reader
-- @func - Reader callback


local function cst_int_rdr(len, func)
	return function(S)
		local pos = S.index + len
		local int = func(S.source, S.index, pos)
		S.index = pos

		return int
	end
end
--[[Engine]]



	--		[TORQUE CURVE VISUAL]
	--		https://www.desmos.com/calculator/nap6stpjqf
	--		Use sliders to manipulate values
	--		Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
	
	Tune.Horsepower		= 150
	Tune.IdleRPM		= 700
	Tune.PeakRPM		= 6000
	Tune.Redline		= 7000
	Tune.EqPoint		= 5252
	Tune.PeakSharpness	= 20
	Tune.CurveMult		= 0.2
	
	Tune.InclineComp	= 1.2		-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Turbo Settings
	Tune.Aspiration		= "Natural"												--[[
	[Aspiration]
		"Natural"		: N/A, Naturally aspirated engine
		"Single"		: Single turbocharger
		"Double"		: Twin turbocharger
		"Super"			: Supercharger												]]
	
	Tune.Boost			= 5			--Max PSI (If you have two turbos and this is 15, the PSI will be 30)
	Tune.TurboSize		= 80		--Turbo size; the bigger it is, the more lag it has.
	Tune.CompressRatio	= 9			--The compression ratio (look it up)
	Tune.Sensitivity	= 0.05		--How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1)
	
	--Misc
	Tune.RevAccel		= 300		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 250		-- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
---------------------------------------------------------------


function onChildAdded(child)
	if child.Name == "SeatWeld" then
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human IN")
			seat.SirenControl.Control.CarName.Value = human.Parent.Name.."'s Car"
			seat.Parent.Name = human.Parent.Name.."'s Car"
			s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
		end
	end
end

function onChildRemoved(child)
	if (child.Name == "SeatWeld") then	
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human OUT")
			seat.Parent.Name = "Empty Car"
			seat.SirenControl.Control.CarName.Value = "Empty Car"
			game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
		end
	end
end


script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
--[[
	Handles client-side behaviors and effects while pulling a wagon
--]]



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

local LocalWalkJumpManager = require(ReplicatedStorage.Source.LocalWalkJumpManager)
local PlayerFacingString = require(ReplicatedStorage.Source.SharedConstants.PlayerFacingString)

local localPlayer = Players.LocalPlayer :: Player

local PullingWagon = {}
PullingWagon.__index = PullingWagon

export type ClassType = typeof(setmetatable({} :: {}, PullingWagon))

function PullingWagon.new(characterModel: Model): ClassType
	local self = {}

	setmetatable(self, PullingWagon)

	-- Only create behaviors and effects for local character
	if characterModel == localPlayer.Character then
		self:_onPullingStarted()
	end

	return self
end

function PullingWagon._onPullingStarted(self: ClassType)
	-- Disable jumping
	LocalWalkJumpManager.getJumpValueManager():setMultiplier(PlayerFacingString.ValueManager.PullingWagon, 0)
end

function PullingWagon.destroy(self: ClassType)
	-- Re-enable jumping
	LocalWalkJumpManager.getJumpValueManager():removeMultiplier(PlayerFacingString.ValueManager.PullingWagon)
end

return PullingWagon
--end



local function displayPath(waypoints)
	local color = BrickColor.Random()
	for index, waypoint in pairs(waypoints) do
		local part = Instance.new("Part")
		part.BrickColor = color
		part.Anchored = true
		part.CanCollide = false
		part.Size = Vector3.new(1,1,1)
		part.Position = waypoint.Position
		part.Parent = workspace
		local Debris = game:GetService("Debris")
		Debris:AddItem(part, 6)
	end
end

local function walkTo(destination)

	local path = getPath(destination)

	if path.Status == Enum.PathStatus.Success then
		for index, waypoint in pairs(path:GetWaypoints()) do
			local target = findTarget()
			if target and target.Humanoid.Health > 0 then
				attack(target)
				break
			else
				humanoid:MoveTo(waypoint.Position)
				humanoid.MoveToFinished:Wait()
			end
		end
	else
		humanoid:MoveTo(destination.Position - (TeddyAI.HumanoidRootPart.CFrame.LookVector * 10))
	end
end

function patrol()
	local waypoints = TeddyAI.Parent.felewaypoints:GetChildren()
	local randomNum = math.random(1, #waypoints)
	walkTo(waypoints[randomNum])
end

while true do
	patrol()
end
----------------------------------
------------FUNCTIONS-------------
----------------------------------



function ShowPiano()
	PianoGui:TweenPosition(
		UDim2.new(0.5, -380, 1, -220),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Sine,
		.5,
		true
	)
end
function HidePiano()
	PianoGui:TweenPosition(
		UDim2.new(0.5, -380, 1, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Sine,
		.5,
		true
	)
end
function ShowSheets()
	SheetsGui:TweenPosition(
		UDim2.new(0.5, -200, 1, -520),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Sine,
		.5,
		true
	)
end
function HideSheets()
	SheetsGui:TweenPosition(
		UDim2.new(0.5, -200, 1, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Sine,
		.5,
		true
	)
end
function ToggleSheets()
	SheetsVisible = not SheetsVisible
	if SheetsVisible then
		ShowSheets()
	else
		HideSheets()
	end
end

function IsBlack(note)
	if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
		return true
	end
end

function HighlightPianoKey(note)
	local keyGui = PianoGui.Keys[note]
	if IsBlack(note) then
		keyGui.BackgroundColor3 = Color3.new(50/255, 50/255, 50/255)
	else
		keyGui.BackgroundColor3 = Color3.new(200/255, 200/255, 200/255)
	end
	delay(.5, function() RestorePianoKey(note) end)
end
function RestorePianoKey(note)
	local keyGui = PianoGui.Keys[note]
	if IsBlack(note) then
		keyGui.BackgroundColor3 = Color3.new(0, 0, 0)
	else
		keyGui.BackgroundColor3 = Color3.new(1, 1, 1)
	end
end

function PianoKeyPressed(Object, note)
	local type = Object.UserInputType.Name
	if type == "MouseButton1" or type == "Touch" then
		PlayNoteClient(note)
	end
end

function ExitButtonPressed(Object)
	local type = Object.UserInputType.Name
	if type == "MouseButton1" or type == "Touch" then
		Deactivate()
	end
end

function SheetsButtonPressed(Object)
	local type = Object.UserInputType.Name
	if type == "MouseButton1" or type == "Touch" then
		ToggleSheets()
	end
end

function SheetsEdited(property)
	if property == "Text" then
		local bounds = SheetsGui.Sheet.ScrollingFrame.TextBox.TextBounds
		SheetsGui.Sheet.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, math.max(14, bounds.Y))
	end
end

function ToggleCaps()
	ShiftLock = not ShiftLock
	if ShiftLock then
		PianoGui.CapsButton.BackgroundColor3 = Color3.new(1, 170/255, 0)
		PianoGui.CapsButton.BorderColor3 = Color3.new(154/255, 103/255, 0)
		PianoGui.CapsButton.TextColor3 = Color3.new(1, 1, 1)
	else
		PianoGui.CapsButton.BackgroundColor3 = Color3.new(140/255, 140/255, 140/255)
		PianoGui.CapsButton.BorderColor3 = Color3.new(68/255, 68/255, 68/255)
		PianoGui.CapsButton.TextColor3 = Color3.new(180/255, 180/255, 180/255)
	end
end

function CapsButtonPressed(Object)
	local type = Object.UserInputType.Name
	if type == "MouseButton1" or type == "Touch" then
		ToggleCaps()
	end
end
--여기까지



local ser = game:GetService("Debris")
local tweenService = game:GetService("TweenService")
local skill = game.ReplicatedStorage.Skill:FindFirstChild(skillName) --스킬 찾기
local Cooldown = true
local DamageCool = false

function tween(X, Y, Z, clone)
	local Posi = {Position = Vector3.new(X, Y, Z)}

	local info = TweenInfo.new(
		0.2,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out,
		0,
		false
	)

	local tween = tweenService:Create(clone, info, Posi)
	tween:Play()
end

script.Parent.SkillEvent.OnServerEvent:Connect(function(plr, X, Y, Z, Target) --플레이어가 스킬을 클릭하면
	if Cooldown == true then
		if Ammo > 0 then
			Ammo -= 1
			local clone = skill:Clone() --스킬 복사
			clone.Parent = game.Workspace.SkillPart --스킬 적용
			clone.Orientation = script.Parent.Handle.Orientation
			clone.Position = script.Parent.Handle.Position
			
			clone.Touched:Connect(function(hit) --다른 플레이어가 스킬에 닿이면
				local human = hit.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기
				local human2 = hit.Parent.Parent:FindFirstChild("Humanoid") --휴머노이드 찾기
				
				if hit ~= script.Parent.Handle then
					local bomb = game.ReplicatedStorage.Skill.Explosion2:Clone()
					bomb.Parent = game.Workspace.SkillPart
					bomb.Position = Vector3.new(clone.Position.X, clone.Position.Y, clone.Position.Z)
					
					ser:AddItem(bomb, 0.2)
					ser:AddItem(clone, Delete)
				end

				if human ~= nil and hit.Parent then
					if hit.Parent.Name == script.Parent.Parent.Name and DamageCool == false then return	end

					if human and DamageCool == false then --해당 조건이 맞으면

						DamageCool = true
						human:TakeDamage(Damage) --데미지 입히기
						wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
						DamageCool = false

					elseif human2 and DamageCool == false then

						DamageCool = true
						human2:TakeDamage(Damage) --데미지 입히기
						wait(DamageCoolTime) --스킬 데미지 쿨타임 기다리기
						DamageCool = false
					end
				end 
			end) --끝

			tween(X, Y, Z, clone)

			script.Parent.Handle:FindFirstChild(Sound):Play() --오디오 틀기
			
		elseif Ammo == 0 then --탄환이 0이 되면
			Cooldown = false
			Ammo = 5 --다시 탄환 충전
			wait(CoolTime) --쿨타임
			Cooldown = true
		end
	end
end) --끝
--[[
===========================================================================
  We assume that instructions are unsigned numbers.
  All instructions have an opcode in the first 6 bits.
  Instructions can have the following fields:
        'A' : 8 bits
        'B' : 9 bits
        'C' : 9 bits
        'Bx' : 18 bits ('B' and 'C' together)
        'sBx' : signed Bx

  A signed argument is represented in excess K; that is, the number
  value is the unsigned value minus K. K is exactly the maximum value
  for that argument (so that -max is represented by 0, and +max is
  represented by 2*max), which is half the maximum for the corresponding
  unsigned argument.
===========================================================================
--]]



luaP.OpMode = { iABC = 0, iABx = 1, iAsBx = 2 }  -- basic instruction format
-- Local Variables


local ScoreFrame = script.Parent.ScreenGui.ScoreFrame
local VictoryFrame = script.Parent.ScreenGui.VictoryMessage
local Events = game.ReplicatedStorage.Events
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local ResetMouseIcon = Events.ResetMouseIcon
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local MouseIcon = Mouse.Icon
--Script (DO NOT TOUCH)


script.Parent.Event:connect(function()
	if debounce == false and script.Parent.Open.Value == false then
		debounce = true
		print("going up")
	doora.PrimPart.Alarm:play()
	wait(4)
	doora.PrimPart.Open:play()
	open()
	for i = 1,50 do
		doora.PrimPart.Alarm.Volume = doora.PrimPart.Alarm.Volume - .06 
		wait()
	end
	doora.PrimPart.Alarm.Volume = 3
	doora.PrimPart.Alarm:stop()
	script.Parent.Open.Value = true
	debounce = false
	elseif debounce == false and script.Parent.Open.Value == true then
		debounce = true
	doora.PrimPart.Alarm:play()
	wait(4)
	doora.PrimPart.Close:play()
	close()
	for i = 1,50 do
		doora.PrimPart.Alarm.Volume = doora.PrimPart.Alarm.Volume - .06 
		wait()
	end
	doora.PrimPart.Alarm.Volume = 3
	doora.PrimPart.Alarm:stop()
	script.Parent.Open.Value = false
	debounce = false
	end
end)
--Main Control------------------------------------------------------------------------


Red = script.Parent.Red.Lamp
Yellow = script.Parent.Yellow.Lamp
Green = script.Parent.Green.Lamp
function Active()
	if Signal.Value == 0 then
		Green.Enabled = false
		Yellow.Enabled = false
		Red.Enabled = false
	elseif Signal.Value == 1 then
		Green.Enabled = true
		Yellow.Enabled = false
		Red.Enabled = false
	elseif Signal.Value == 2 then
		Green.Enabled = false
		Yellow.Enabled = true
		Red.Enabled = false
	elseif Signal.Value == 3 then
		Green.Enabled = false
		Yellow.Enabled = false
		Red.Enabled = true
	end
end
Signal.Changed:connect(Active)
--



function spring:update(dt)
	local displacement = self.position - self.target;
	local springForce = -self.stiffness * displacement;
	local dampForce = -self.damping * self.velocity;
	
	local acceleration = springForce + dampForce;
	local newVelocity = self.velocity + acceleration*dt;
	local newPosition = self.position + newVelocity;
	
	if (absDist(newVelocity) < self.precision and absDist(self.target - newPosition) < self.precision) then
		self.position = self.target;
		self.velocity = self.velocity - self.velocity;
		return;
	end
	
	self.position = newPosition;
	self.velocity = newVelocity;
end
--[[
	Function called upon entering the state
]]


function PlayerCamera.onEnter(stateMachine, serverPlayer, event, from, to)
	local player = serverPlayer.player

	coroutine.wrap(
		function()
			local character = player.Character or player.CharacterAdded:Wait()
			local primaryPart = character.PrimaryPart

			onCharacterAdded(stateMachine, player, character)

			MonsterManager.createInterestWhileTrue(
				primaryPart.Position,
				NOISE_GENERATED,
				function()
					return stateMachine.current == "camera"
				end
			)
		end
	)()

	connections.leaveCamera =
		LeaveCamera.OnServerEvent:Connect(
		function(sendingPlayer)
			if sendingPlayer == player then
				stateMachine:endCamera()
			end
		end
	)
end
--[[
	Returns a boolean about whether the `assetType` is actually a Classic Clothing type.

	This function is called right before a split in functionality is required
	between different types of assets, such as equipping.

    See related function `isAccessory`.
]]



local MerchBooth = script:FindFirstAncestor("MerchBooth")
local t = require(MerchBooth.Packages.t)

function isClassicClothing(assetType: Enum.AssetType): boolean
	assert(t.enum(Enum.AssetType)(assetType))

	if assetType == Enum.AssetType.TShirt or assetType == Enum.AssetType.Shirt or assetType == Enum.AssetType.Pants then
		return true
	end

	return false
end

return isClassicClothing
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	plrData.Money.Gold.Value = plrData.Money.Gold.Value - 10
	plrData.Character.Injuries.BrokenRib.Value = false
end
--[[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													]]
--[[
8888ba.88ba   .d888888  888888ba   .88888.   .88888.  dP    dP .d88888b      88888888b  888888ba   .d888888  8888ba.88ba   88888888b dP   dP   dP  .88888.   888888ba  dP     dP 
88  `8b  `8b d8'    88  88    `8b d8'   `8b d8'   `8b Y8.  .8P 88.    "'     88         88    `8b d8'    88  88  `8b  `8b  88        88   88   88 d8'   `8b  88    `8b 88   .d8' 
88   88   88 88aaaaa88a 88     88 88     88 88     88  Y8aa8P  `Y88888b.    a88aaaa    a88aaaa8P' 88aaaaa88a 88   88   88 a88aaaa    88  .8P  .8P 88     88 a88aaaa8P' 88aaa8P'  
88   88   88 88     88  88     88 88     88 88     88 d8'  `8b       `8b     88         88   `8b. 88     88  88   88   88  88        88  d8'  d8' 88     88  88   `8b. 88   `8b. 
88   88   88 88     88  88    .8P Y8.   .8P Y8.   .8P 88    88 d8'   .8P     88         88     88 88     88  88   88   88  88        88.d8P8.d8P  Y8.   .8P  88     88 88     88 
dP   dP   dP 88     88  8888888P   `8888P'   `8888P'  dP    dP  Y88888P      dP         dP     dP 88     88  dP   dP   dP  88888888P 8888' Y88'    `8888P'   dP     dP dP     dP 
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
The good one
]]



local ServerStorage;
local ServerScriptService;
local Players = game:GetService("Players")
local Replicated = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local FWork = {}
local Modules = {}

FWork.Loaded = false

local SModulesFolder; 
local ModulesFolder = Replicated:WaitForChild("Package").Modules
if not RunService:IsClient() then 
	ServerStorage = game:GetService("ServerStorage")
	ServerScriptService = game:GetService("ServerScriptService")
	SModulesFolder = ServerStorage:WaitForChild("Package").Modules
end 

function FWork:Init() --initializes the module
	for _,module in pairs(script:GetChildren()) do 
		if module:IsA("ModuleScript") then 
			for i,v in pairs(require(module)) do 
				FWork[i] = v
			end
		end
	end
	for _,module in pairs(ModulesFolder:GetChildren()) do 
		if module:IsA("ModuleScript") then 
			Modules[module.Name] = require(module)
		end
	end
	if SModulesFolder ~= nil then 
		for _,module in pairs(SModulesFolder:GetChildren()) do 
			if module:IsA("ModuleScript") then 
				Modules[module.Name] = require(module)
			end
		end
	end
	for i,v in pairs(Modules) do 
		if v.Init ~= nil then 
			v:Init()
		end
	end
	wait()
	FWork.Loaded = true
end

function FWork:Get(Name) --used for getting cached modules
	if Modules[Name] ~= nil then return Modules[Name] end
end

function FWork.newModule() --used for module creation
	local Module = {}

	setmetatable(Module,{
		__index = FWork;
	})

	function Module:Init() end

	return Module
end

return FWork