Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Creates a spread simulator based on the weapons runtime data
-- @param WeaponRuntimeData
-- @return SpreadSimulator


function SpreadSimulator.New(weaponRuntimeData)
	local self = {}
	setmetatable(self,SpreadSimulator)

	self.runtimeData = weaponRuntimeData	
	self.weaponDefinition = weaponRuntimeData:GetWeaponDefinition()
	
	if not self.weaponDefinition:GetSpreadRange() then
		return nil
	end
	
	-- Constants
	self.minSpread = self.weaponDefinition:GetSpreadRange().x
	self.maxSpread = self.weaponDefinition:GetSpreadRange().y
	self.spreadIntensity = self.weaponDefinition:GetSpreadIntensity()
	self.spreadReduction = self.weaponDefinition:GetSpreadReduction()
	self.rng = Random.new()
	
	-- Variables
	self.currentSpread = self.minSpread

	return self
end
--None of this is mine...



Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}

function Equip(mouse)
wait(0.01)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(0.9, 0.6, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(270), math.rad(25), math.rad(0)) ---The first set of numbers changes where the arms move to the second set changes their angles
welds[1] = weld1
weld1.Name = "weld1"
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1, 0.6, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-20), 0) --- Same as top
welds[2] = weld2
weld2.Name = "weld2"
end
else
print("sh")
end
else
print("arms")
end
end

function Unequip(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
end
else
print("sh")
end
else
print("arms")
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 350		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 4.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 0			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--[=[
	Declarative UI system inspired by Fusion
	@class Blend
]=]



local require = require(script.Parent.loader).load(script)

local AccelTween = require("AccelTween")
local BlendDefaultProps = require("BlendDefaultProps")
local Brio = require("Brio")
local Maid = require("Maid")
local MaidTaskUtils = require("MaidTaskUtils")
local Observable = require("Observable")
local Promise = require("Promise")
local Rx = require("Rx")
local BrioUtils = require("BrioUtils")
local RxInstanceUtils = require("RxInstanceUtils")
local RxValueBaseUtils = require("RxValueBaseUtils")
local Signal = require("Signal")
local Spring = require("Spring")
local SpringUtils = require("SpringUtils")
local StepUtils = require("StepUtils")
local ValueBaseUtils = require("ValueBaseUtils")
local ValueObject = require("ValueObject")
local ValueObjectUtils = require("ValueObjectUtils")

local Blend = {}
--[=[
	@interface ComponentConfig
	@within Component
	.Tag string -- CollectionService tag to use
	.Ancestors {Instance}? -- Optional array of ancestors in which components will be started
	.Extensions {Extension}? -- Optional array of extension objects

	Component configuration passed to `Component.new`.

	- If no Ancestors option is included, it defaults to `{workspace, game.Players}`.
	- If no Extensions option is included, it defaults to a blank table `{}`.
]=]


type ComponentConfig = {
	Tag: string,
	Ancestors: AncestorList?,
	Extensions: {Extension}?,
}
--This Script works for R6 R15 and Rthro!!


local JumpHeight = 200
local Can = true
script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Left Leg"
		or hit.Name == "Right Leg"
		or hit.Name == "Torso"
		or hit.Name == "Left Arm"
		or hit.Name == "Right Arm"
		or hit.Name == "LeftFoot"
		or hit.Name == "RightFoot"
		or hit.Name == "HumanoidRootPart"
		or hit.Name == "RightHand"
		or hit.Name == "LeftHand"
		or hit.Name == "Head" then
		if Can == true then
			Can = false
			local Character=hit.Parent
			local HumanoidRootPart=Character:WaitForChild("HumanoidRootPart")
			local Boost=Instance.new("BodyPosition",HumanoidRootPart)
			Boost.D=1000
			Boost.P=15000
			Boost.MaxForce=Vector3.new(0,100000000,0)
			Boost.Position=Vector3.new(0,HumanoidRootPart.Position.Y + JumpHeight,0)
			
			--Delete The Next Line After This One For No Sound
			script.Parent.Spring:Play()

			--(Not Recomended) Change To How Long The 'Boost' Exists
			game.Debris:AddItem(Boost,0.6)
			wait(0.75)
			Can=true
		end
	end
end)
--[[Run]]



	--Print Version
	local ver=require(car["A-Chassis Tune"].README)
	print("//INSPARE: AC6 Loaded - Build "..ver)
	
	--Runtime Loops
	
	-- ~60 c/s
	game["Run Service"].Stepped:connect(function()
		--Steering
		Steering()
		
		--RPM
		RPM()
		
		--Update External Values
		_IsOn = car.DriveSeat.IsOn.Value
		_InControls = script.Parent.ControlsOpen.Value
		script.Parent.Values.Gear.Value = _CGear
		script.Parent.Values.RPM.Value = _RPM
		script.Parent.Values.Horsepower.Value = _HP
		script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
		script.Parent.Values.TransmissionMode.Value = _TMode
		script.Parent.Values.Throttle.Value = _GThrot
		script.Parent.Values.Brake.Value = _GBrake
		script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
		script.Parent.Values.SteerT.Value = _GSteerT
		script.Parent.Values.PBrake.Value = _PBrake
		script.Parent.Values.TCS.Value = _TCS
		script.Parent.Values.TCSActive.Value = _TCSActive
		script.Parent.Values.ABS.Value = _ABS
		script.Parent.Values.ABSActive.Value = _ABSActive
		script.Parent.Values.MouseSteerOn.Value = _MSteer
		script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
	end)
	
	-- ~15 c/s
	while wait(.0667) do
		--Power
		Engine()
		
		--Flip
		if _Tune.AutoFlip then Flip() end
	end
-----<< CONNECTIONS >>-----



tool.Equipped:Connect(equip)
tool.Unequipped:Connect(unequip)
game.ReplicatedStorage:WaitForChild("ROBLOX_PistolHitEvent").OnClientEvent:Connect(hitmarkerUpdate)
game.ReplicatedStorage:WaitForChild("ROBLOX_PistolShotEvent").OnClientEvent:Connect(function(mag, ammo) updateWeaponHud(mag, ammo) end)
----- Script: -----



Button.Activated:Connect(function()
	if Information.Case.Value == 0 then
		Messages.Type.SelectPackage.Value = true
		Messages.FireMessage.Value = true
	elseif Information.Case.Value == 1 then
		BuyCaseEvents.Case1:FireServer(Information.PricePoints.Value,Information.PriceGems.Value,true)
	end
end)
-- Do not edit these values, they are not the developer-set limits, they are limits
-- to the values the camera system equations can correctly handle


local MIN_ALLOWED_ELEVATION_DEG = -80
local MAX_ALLOWED_ELEVATION_DEG = 80

local externalProperties = {}
externalProperties["InitialDistance"]  = 25
externalProperties["MinDistance"]      = 10
externalProperties["MaxDistance"]      = 100
externalProperties["InitialElevation"] = 35
externalProperties["MinElevation"]     = 35
externalProperties["MaxElevation"]     = 35
externalProperties["ReferenceAzimuth"] = -45	-- Angle around the Y axis where the camera starts. -45 offsets the camera in the -X and +Z directions equally
externalProperties["CWAzimuthTravel"]  = 90	-- How many degrees the camera is allowed to rotate from the reference position, CW as seen from above
externalProperties["CCWAzimuthTravel"] = 90	-- How many degrees the camera is allowed to rotate from the reference position, CCW as seen from above
externalProperties["UseAzimuthLimits"] = false -- Full rotation around Y axis available by default

local Util = require(script.Parent:WaitForChild("CameraUtils"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
--[=[
	Short hand to register an event from the instance

	```lua
		Blend.mount(workspace, {
			[Blend.OnEvent "ChildAdded"] = function(child)
				print("Child added", child)
			end;
		})

		local folder = Instance.new("Folder")
		folder.Name = "Hi"
		folder.Parent = workspace --> prints "Child added Hi"
	```

	@param eventName string
	@return (instance: Instance) -> Observable
]=]


function Blend.OnEvent(eventName)
	assert(type(eventName) == "string", "Bad eventName")

	return function(instance)
		return Rx.fromSignal(instance[eventName])
	end
end
--Output Cache	


local NCache = {}
local ECache = {}
local TCache = {}
local SCache = {}

for gear,ratio in pairs(_Tune.Ratios) do
	local nhpPlot = {}
	local ehpPlot = {}
	local thpPlot = {}
	local shpPlot = {}
	for rpm = 0, math.ceil((_Tune.Redline+100)/100) do
		local ntqPlot = {}
		local etqPlot = {}
		local ttqPlot = {}
		local stqPlot = {}
		if rpm~=0 then
			if _Tune.Engine then
				ntqPlot.Horsepower,ntqPlot.Torque = GetNCurve(rpm*100,gear-2)
				if _TCount~=0 then
					ttqPlot.Horsepower,ttqPlot.Torque = GetTCurve(rpm*100,gear-2)
				else
					ttqPlot.Horsepower,ttqPlot.Torque = 0,0
				end
				if _SCount~=0 then
					stqPlot.Horsepower,stqPlot.Torque = GetSCurve(rpm*100,gear-2)
				else
					stqPlot.Horsepower,stqPlot.Torque = 0,0
				end
			else
				ntqPlot.Horsepower,ntqPlot.Torque = 0,0
				ttqPlot.Horsepower,ttqPlot.Torque = 0,0
				stqPlot.Horsepower,stqPlot.Torque = 0,0
			end
			if _Tune.Electric then
				etqPlot.Horsepower,etqPlot.Torque = GetECurve(rpm*100,gear-2)
			else
				etqPlot.Horsepower,etqPlot.Torque = 0,0
			end
		else
			ntqPlot.Horsepower,ntqPlot.Torque = 0,0
			etqPlot.Horsepower,etqPlot.Torque = 0,0
			ttqPlot.Horsepower,ttqPlot.Torque = 0,0
			stqPlot.Horsepower,stqPlot.Torque = 0,0
		end
		if _Tune.Engine then
			nhp,ntq = GetNCurve((rpm+1)*100,gear-2)
			if _TCount~=0 then
				thp,ttq = GetTCurve((rpm+1)*100,gear-2)
			else
				thp,ttq = 0,0
			end
			if _SCount~=0 then
				shp,stq = GetSCurve((rpm+1)*100,gear-2)
			else
				shp,stq = 0,0
			end
		else
			nhp,ntq = 0,0
			thp,ttq = 0,0
			shp,stq = 0,0
		end
		if _Tune.Electric then
			ehp,etq = GetECurve((rpm+1)*100,gear-2)
		else
			ehp,etq = 0,0
		end
		ntqPlot.HpSlope,ntqPlot.TqSlope = (nhp-ntqPlot.Horsepower),(ntq-ntqPlot.Torque)
		etqPlot.HpSlope,etqPlot.TqSlope = (ehp-etqPlot.Horsepower),(etq-etqPlot.Torque)
		ttqPlot.HpSlope,ttqPlot.TqSlope = (thp-ttqPlot.Horsepower),(ttq-ttqPlot.Torque)
		stqPlot.HpSlope,stqPlot.TqSlope = (shp-stqPlot.Horsepower),(stq-stqPlot.Torque)
		nhpPlot[rpm] = ntqPlot
		ehpPlot[rpm] = etqPlot
		thpPlot[rpm] = ttqPlot
		shpPlot[rpm] = stqPlot
	end
	table.insert(NCache,nhpPlot)
	table.insert(ECache,ehpPlot)
	table.insert(TCache,thpPlot)
	table.insert(SCache,shpPlot)
end
--------------------[ SPRINTING FUNCTIONS ]-------------------------------------------



function MonitorStamina()
	while Run_Key_Pressed do
		if (not Aimed) and (not Aiming) then 
			break
		end
		RS:wait()
	end
	while Run_Key_Pressed and (not Aiming) and (not Aimed) and (not Knifing) and (not ThrowingGrenade) do
		local Forward = (Keys["w"] or Keys[string.char(17)])
		local Backward = (Keys["s"] or Keys[string.char(18)])
		if (Forward and (not Backward))
		and Walking and (Stamina > 0) then
			if Stance == 1 or Stance == 2 then Stand() end
			local NewStamina = Stamina - 1
			Stamina = (NewStamina < 0 and 0 or NewStamina)
			Running = true
		elseif (not (Forward and (not Backward)))
		or (not Walking) or (Stamina == 0) then
			break
		end
		RS:wait()
	end
	Running = false
	RechargeStamina()
end

function RechargeStamina()
	ChargingStamina = true
	while ((not Run_Key_Pressed) or (Stamina < MaxStamina)) and (not Running) do
		if Stamina < MaxStamina then
			local NewStamina = Stamina + (S.SprintTime / S.StaminaCoolTime)
			Stamina = (NewStamina > MaxStamina and MaxStamina or NewStamina)
		elseif Stamina >= MaxStamina then
			break
		end
		RS:wait()
	end
	ChargingStamina = false
end
--[[script.Parent.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	local Effect = game.ReplicatedStorage.FlameSkill.SkillV
	local Weld = Instance.new("Weld")
    Weld.Parent = char.Head
	Weld.Part0 = char.HumanoidRootPart
    local FX = Effect:Clone()
    FX.Parent = char.Head
	Weld.Part1 = char.Head.SkillV
	Weld.C1 = CFrame.new (0, -30, 0)
end)]]


script.Parent.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	local Effect = game.ReplicatedStorage.FlameSkill.SkillV
	local FX = Effect:Clone()
	local energy = plr.Hamon
	--local FX = game.ReplicatedStorage.FlameSkill.SkillV:Clone()
	FX.Parent = char.Head
	FX.CFrame = char.HumanoidRootPart.CFrame + Vector3.new(0, 60, 0)
	FX.Anchored = true
	local Effect2 = game.ReplicatedStorage.FlameSkill.FlameV
	local FX2 = Effect2:Clone()
	if char.Humanoid.FloorMaterial == "Plastic" then
		FX2.Transparency = 0
	end
	FX2.Parent = char.Head
	FX2.CFrame = char.HumanoidRootPart.CFrame + Vector3.new(0, -10, 0)
	FX2.Anchored = true
	--FX2.Script.Disabled = false
	
	energy.Value = energy.Value + 100
	--FX.Script.Disabled = false
end)
-- Note: The active transparency controller could be made to listen for this event itself.


function CameraModule:OnCameraSubjectChanged()
	if self.activeTransparencyController then
		self.activeTransparencyController:SetSubject(game.Workspace.CurrentCamera.CameraSubject)
	end
	
	if self.activeOcclusionModule then
		self.activeOcclusionModule:OnCameraSubjectChanged(game.Workspace.CurrentCamera.CameraSubject)
	end
end

function CameraModule:OnCameraTypeChanged(newCameraType)
	if newCameraType == Enum.CameraType.Scriptable then
		if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
			UserInputService.MouseBehavior = Enum.MouseBehavior.Default
		end
	end
	
	-- Forward the change to ActivateCameraController to handle
	self:ActivateCameraController(nil, newCameraType)	
end
--Numbers


local Num1 = script.Parent.Code1Fake.CodeSet.Value
local Num2 = script.Parent.Code2Fake.CodeSet.Value
local Num3 = script.Parent.Code3Fake.CodeSet.Value
local FNum1 = script.Parent.Code1Fake.MainCode.NumberGUI.TextLabel
local FNum2 = script.Parent.Code2Fake.MainCode.NumberGUI.TextLabel
local FNum3 = script.Parent.Code3Fake.MainCode.NumberGUI.TextLabel
local Code = script.Parent.Code
local EnteredCode = script.Parent.EnteredCode
local Ready = script.Parent.Ready
Num1 = math.random(1,4)
Num2 = math.random(1,4)
Num3 = math.random(1,4)
if Num1 == 1 then
	FNum1.Text = "I"
elseif Num1 == 2 then
	FNum1.Text = "II"
elseif Num1 == 3 then
	FNum1.Text = "III"
elseif Num1 == 4 then
	FNum1.Text = "IV"
end
if Num2 == 1 then
	FNum2.Text = "I"
elseif Num2 == 2 then
	FNum2.Text = "II"
elseif Num2 == 3 then
	FNum2.Text = "III"
elseif Num2 == 4 then
	FNum2.Text = "IV"
end
if Num3 == 1 then
	FNum3.Text = "I"
elseif Num3 == 2 then
	FNum3.Text = "II"
elseif Num3 == 3 then
	FNum3.Text = "III"
elseif Num3 == 4 then
	FNum3.Text = "IV"
end
Code.Value = tostring(Num1)..""..tostring(Num2)..""..tostring(Num3)
Ready = true
--- Skill


repeat wait() until game.Players.LocalPlayer.Character

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local Torso = char:WaitForChild("LowerTorso")
local Mouse = plr:GetMouse()
local toggle = false
local Debounce = true
Mouse.KeyDown:Connect(function(key)
    if key == "f" and Tool.Equip.Value == true and Tool.Active.Value == "None" or Tool.Active.Value == "SunaFlight" then
        if toggle == false and Debounce == true then
            toggle = true
            local Anim = Instance.new("Animation")
            Anim.AnimationId = "rbxassetid://4865646330"
            local PlayAnim = hum:LoadAnimation(Anim)
            PlayAnim:Play()
            Debounce = false
            Tool.Active.Value = "SunaFlight"
		    script.Fire:FireServer(plr)
            local BV = Instance.new("BodyVelocity",Torso)
            BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
            while toggle == true do
                wait()
            plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.x,plr.Character.HumanoidRootPart.Position.y,Mouse.Hit.p.z))
            BV.Velocity = Mouse.Hit.lookVector * 110
            end
        end
        if toggle == true and Debounce == false then
            toggle = false
            Tool.Active.Value = "None"
            script.UnFire:FireServer(plr)
            Torso:FindFirstChildOfClass("BodyVelocity"):Destroy()
            local tracks = hum:GetPlayingAnimationTracks()
            for i, stoptracks in pairs(tracks) do
            stoptracks:Stop()
            end
            local Anim = Instance.new("Animation")
            Anim.AnimationId = "http://www.roblox.com/asset/?id=507767968"
            local PlayAnim = hum:LoadAnimation(Anim)
            PlayAnim:Play()
            wait(3.5)
            Debounce = true
        end
    end
end)
-- Function to bind to reload event


local function reload(player)
	if not reloading and currentAmmo < clipSize and tool.Equipped then
		tool.Handle.ReloadSound:Play()
		reloading = true
		canFire = false
		if infiniteAmmo then -- dealing with infinite ammo
			shotEvent:FireClient(player, "--", clipSize)
			wait(reloadTime)
			currentAmmo = clipSize
			shotEvent:FireClient(player, currentAmmo, clipSize)
		elseif consolidateAmmo then -- dealing with limited ammo that saves what's in your current clip
			remainingAmmo = currentAmmo
			shotEvent:FireClient(player, "--", ammoLeft)
			wait(reloadTime)
			currentAmmo = math.min(clipSize, (ammoLeft + remainingAmmo))
			ammoLeft = (ammoLeft + remainingAmmo) - math.min(clipSize, (ammoLeft + remainingAmmo))
			shotEvent:FireClient(player, currentAmmo, ammoLeft)
		else -- dealing with limited ammo where you throw away any ammo remaining in your clip when you reload
			shotEvent:FireClient(player, "--", ammoLeft)
			wait(reloadTime)
			currentAmmo = math.min(clipSize, ammoLeft)
			ammoLeft = ammoLeft - math.min(clipSize, ammoLeft)
			shotEvent:FireClient(player, currentAmmo, ammoLeft)
		end
		canFire = true
		reloading = false
	end
end
--DO NOT DELETE, THIS WILL BREAK THE GUN



function Stick(x, y)
	local W = Instance.new("Weld")
	W.Part0 = x
	W.Part1 = y
	local CJ = CFrame.new(x.Position)
	local C0 = x.CFrame:inverse()*CJ
	local C1 = y.CFrame:inverse()*CJ
	W.C0 = C0
	W.C1 = C1
	W.Parent = x
end

function Get(A)
	if A.ClassName == ("Part") then
		Stick(script.Parent.Handle, A)
		A.Anchored = false
	else
		local C = A:GetChildren()
		for i=1, #C do
		Get(C[i])
		end
	end
end

function Finale()
	Get(script.Parent)
end

script.Parent.Equipped:Connect(Finale)
script.Parent.Unequipped:Connect(Finale)
Finale()
-- Thanks for using my Baldi's Basics Stamina GUI! (this is better than the other ones out there)
-- You don't have to give credit since it's just a gui, but it's appreciated!



local maingui = script.Stamina:Clone()
script.Stamina:Destroy()

script.Archivable = false
script.Parent = nil -- Hides the script

game.Players.PlayerAdded:Connect(function(player)
	local function LoadGuis(player)
		game:GetService("RunService").Heartbeat:Wait() -- waits for any script that auto-clears guis to do its job
		local plrguis = player:FindFirstChild("PlayerGui")
		if (plrguis) then
			local oldgui = plrguis:FindFirstChild("Stamina")
			if (oldgui) then
				oldgui:Destroy()
			end
			local gui = maingui:Clone()
			local event = gui.Frame:WaitForChild("Speed")
			event.OnServerEvent:Connect(function(plr,sec,spd)
				if (sec == 1055299) then
					local hum = plr.Character:FindFirstChildWhichIsA("Humanoid")
					if hum ~= nil then
						hum.WalkSpeed = spd
					end
				end
			end);
			gui.Parent = plrguis
		end
	end
	LoadGuis(player)
	player.CharacterAdded:Connect(function() LoadGuis(player) end)
end)
-- Private Methods


	
local function shortestDist(start, stop)
	local modDiff = (stop - start) % TAU
	local sDist = PI - math.abs(math.abs(modDiff) - PI)
	if ((modDiff + TAU) % TAU < PI) then
		return sDist
	else
		return -sDist
	end
end

function init(self)
	local subN = self.SubN
	local dial = self.Frame.RadialDial
	
	local inputType = Enum.UserInputType.MouseMovement
	
	self._Maid:Mark(self._ClickedBind)
	self._Maid:Mark(self._HoverBind)
	
	self._Maid:Mark(UIS.LastInputTypeChanged:Connect(function(iType)
		if (MOUSE_GROUP[iType] or GAMEPAD_GROUP[iType]) then
			inputType = iType
		end
	end))
	
	local lTheta = 0
	
	self._Maid:Mark(UIS.InputBegan:Connect(function(input)
		if (not self.Enabled) then
			return
		end
		
		
		if (GAMEPAD_GROUP[input.UserInputType]) then
			if (not GAMEPAD_CLICK[input.KeyCode]) then
				return
			else
				self._ClickedBind:Fire(self:PickIndex(lTheta))
			end
		end
		
		local theta = self:GetTheta(input.UserInputType)
		if (theta) then
			self._ClickedBind:Fire(self:PickIndex(theta))
		end
	end))

	self._Maid:Mark(RUNSERVICE.RenderStepped:Connect(function(dt)
		if (not self.Enabled) then
			return
		end
		
		local theta = self:GetTheta(inputType)
		if (theta and self:IsVisible()) then
			lTheta = theta
			
			local frameRot = math.rad(self.Frame.Rotation)
			local toDeg = math.deg(theta - self.Rotation + frameRot + EX_OFFSET + 2*TAU) % 360
			local closest = toDeg / (360 / self.SubN) + 0.5
			
			dial.Rotation = math.deg(self:GetRotation(closest))
			
			local index = self:PickIndex(theta)
			if (index ~= self._LastHoverIndex) then
				self._HoverBind:Fire(self._LastHoverIndex, index)
				self._LastHoverIndex = index
			end
		end
	end))
end
--------------------------UTIL LIBRARY-------------------------------


local Utility = {}
do
	local function FindCharacterAncestor(part)
		if part then
			local humanoid = part:FindFirstChildOfClass("Humanoid")
			if humanoid then
				return part, humanoid
			else
				return FindCharacterAncestor(part.Parent)
			end
		end
	end
	Utility.FindCharacterAncestor = FindCharacterAncestor

	local function Raycast(ray, ignoreNonCollidable, ignoreList)
		ignoreList = ignoreList or {}
		local hitPart, hitPos, hitNorm, hitMat = Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
		if hitPart then
			if ignoreNonCollidable and hitPart.CanCollide == false then
				-- We always include character parts so a user can click on another character
				-- to walk to them.
				local _, humanoid = FindCharacterAncestor(hitPart)
				if humanoid == nil then
					table.insert(ignoreList, hitPart)
					return Raycast(ray, ignoreNonCollidable, ignoreList)
				end
			end
			return hitPart, hitPos, hitNorm, hitMat
		end
		return nil, nil
	end
	Utility.Raycast = Raycast
end

local humanoidCache = {}
local function findPlayerHumanoid(player)
	local character = player and player.Character
	if character then
		local resultHumanoid = humanoidCache[player]
		if resultHumanoid and resultHumanoid.Parent == character then
			return resultHumanoid
		else
			humanoidCache[player] = nil -- Bust Old Cache
			local humanoid = character:FindFirstChildOfClass("Humanoid")
			if humanoid then
				humanoidCache[player] = humanoid
			end
			return humanoid
		end
	end
end