Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[ Use Examples

-- To be used on the client.
local fullscreenModule = require(game:GetService("ReplicatedStorage"):WaitForChild("FullscreenModule"))
local screen = workspace:WaitForChild("CountdownBoardPart")

-- Creates a button that allows the user to toggle focus on a screen
fullscreenModule.CreateButtonToFocusScreen(screen)

fullscreenModule.FocusScreen(screen)	-- Forces the client to focus on a screen
wait(5)
fullscreenModule.FocusScreen()	-- Forces the client to focus back on their character

]]



local fullscreenModule = {}
fullscreenModule.FocusedScreen = nil

local TweenService = game:GetService("TweenService")
local PlayersService = game:GetService("Players")
local RunService = game:GetService("RunService")
local StarterPlayer = game:GetService("StarterPlayer")
local UserInputService = game:GetService("UserInputService")

local buttonGuiTemplate = script:WaitForChild("FullscreenButtonGui")
local localPlayer = PlayersService.LocalPlayer
local camera = workspace.CurrentCamera
local buttonGui = nil
local button = nil
local buttonTargetScreen = nil
local buttonConnection = nil
local gamepadButtonConnection = nil
local lockCameraConnection = nil
local characterCamCF = nil
local characterCamCFIsRelative = false
local transitionCount = 0

local ZOOM_IN_ICON = "rbxassetid://9597519667"
local ZOOM_OUT_ICON = "rbxassetid://9597519299"

local FULLSCREEN_GAMEPAD_BUTTON = Enum.KeyCode.ButtonY
local FULLSCREEN_GAMEPAD_BUTTON_ICON = "rbxassetid://9596106684"
local BACKOUT_GAMEPAD_BUTTON = Enum.KeyCode.ButtonB
local BACKOUT_GAMEPAD_BUTTON_ICON = "rbxassetid://9596106237"
--[[

	remoteSignal = RemoteSignal.new()

	remoteSignal:Connect(handler: (player: Player, ...args: any) -> void): RBXScriptConnection
	remoteSignal:Fire(player: Player, ...args: any): void
	remoteSignal:FireAll(...args: any): void
	remoteSignal:FireExcept(player: Player, ...args: any): void
	remoteSignal:Wait(): (...any)
	remoteSignal:Destroy(): void

--]]




local IS_SERVER = game:GetService("RunService"):IsServer()

local t = require( script.Parent.Parent.t )

local Players = game:GetService("Players")
local Ser = require(script.Parent.Parent.Ser)

local RemoteSignal = {}
RemoteSignal.__index = RemoteSignal


function RemoteSignal.Is(object)
	return type(object) == "table" and getmetatable(object) == RemoteSignal
end


function RemoteSignal.new()
	assert(IS_SERVER, "RemoteSignal can only be created on the server")
	local self = setmetatable({
		_remote = Instance.new("RemoteEvent");
	}, RemoteSignal)
	return self
end


local tFire = t.tuple( t.instanceIsA("Player") )
function RemoteSignal:Fire(player, ...)
	assert( tFire(player) )
	self._remote:FireClient(player, Ser.SerializeArgsAndUnpack(...))
end


function RemoteSignal:FireAll(...)
	self._remote:FireAllClients(Ser.SerializeArgsAndUnpack(...))
end


local tFireExcept = t.tuple( t.instanceIsA("Player") )
function RemoteSignal:FireExcept(player, ...)
	assert( tFireExcept(player) )
	local args = Ser.SerializeArgs(...)
	for _,plr in ipairs(Players:GetPlayers()) do
		if plr ~= player then
			self._remote:FireClient(plr, Ser.UnpackArgs(args))
		end
	end
end


local tFireSome = t.tuple( t.values(t.instanceIsA("Player")) )
function RemoteSignal:FireSome( playerList: {}, ... ): ()
	assert( tFireSome(playerList) )
	local args = Ser.SerializeArgs( ... )
	for _, player: Player in pairs( playerList ) do
		if ( player and player:IsDescendantOf(Players) ) then
			self._remote:FireClient( player, Ser.UnpackArgs(args) )
		end
	end
end


function RemoteSignal:Wait()
	return self._remote.OnServerEvent:Wait()
end


function RemoteSignal:Connect(handler)
	return self._remote.OnServerEvent:Connect(function(player, ...)
		handler(player, Ser.DeserializeArgsAndUnpack(...))
	end)
end


function RemoteSignal:Destroy()
	self._remote:Destroy()
	self._remote = nil
end


return RemoteSignal
--[[
	@class SoftShutdownUI.story
]]



local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)

local Maid = require("Maid")
local SoftShutdownTranslator = require("SoftShutdownTranslator")
local SoftShutdownUI = require("SoftShutdownUI")
local ServiceBag = require("ServiceBag")

return function(target)
	local maid = Maid.new()
	local serviceBag = ServiceBag.new()
	maid:GiveTask(serviceBag)

	local translator = serviceBag:GetService(SoftShutdownTranslator)

	local softShutdownUI = SoftShutdownUI.new()
	maid:GiveTask(softShutdownUI)

	maid:GivePromise(translator:PromiseFormatByKey("shutdown.lobby.title")):Then(function(text)
		softShutdownUI:SetTitle(text)
	end)

	maid:GivePromise(translator:PromiseFormatByKey("shutdown.lobby.subtitle")):Then(function(text)
		softShutdownUI:SetSubtitle(text)
	end)

	softShutdownUI:Show()

	softShutdownUI.Gui.Parent = target

	return function()
		maid:DoCleaning()
	end
end
--Do not change anything below unless you know what youre doing!


script.Parent.Sound:Play()

script.Parent.MouseButton1Click:connect(function()
 if script.Parent.Sound.IsPlaying then
  script.Parent.Sound:Stop()
  script.Parent.TextLabel.Visible= false
  script.Parent.TextLabel2.Visible=true
 else
 script.Parent.Sound:Play()
 script.Parent.TextLabel.Visible=true
 script.Parent.TextLabel2.Visible=false
  
 end
end)
-------------------------------------


equiped=false
sp=script.Parent
RayLength=100000
Spread=0.06
enabled=true
reloading=false
down=false
r=game:service("RunService")
last=0
last2=0
last3=0
last4=0
last5=0
last6=0

p = Instance.new("Part")
p.Parent = game.Lighting
p.Name = "BulletTexture"
p.CanCollide = false
p.formFactor = "Custom"
p.Size = Vector3.new(1,0.1,1)
p.Transparency = 1
g = Instance.new("SpecialMesh")
g.Parent = p

Bullet=Instance.new("Part")
Bullet.Name="Bullet"
Bullet.BrickColor=BrickColor.new("New Yeller")
Bullet.Anchored=true
Bullet.CanCollide=false
Bullet.Locked=true
Bullet.Size=Vector3.new(1,1,1)
--!strict
--[=[
  @function map
  @within Set

  @param set { [T]: boolean } -- The set to map.
  @param mapper (T, {[T]: boolean}) -> U -- The mapper function.
  @return {[U]: boolean} -- The mapped set.

  Iterates over a set, calling a mapper function for each item.

  ```lua
  local set = { hello = true, world = true }

  local mappedSet = Map(set, function(value)
    return value .. "!"
  end) -- { ["hello!"] = true, ["world!"] = true }
  ```
]=]


local function map<T, U>(set: { [T]: boolean }, mapper: (T, { [T]: boolean }) -> U): { [U]: boolean }
	local result = {}

	for key, _ in pairs(set) do
		local mappedKey = mapper(key, set)

		if mappedKey ~= nil then
			result[mappedKey] = true
		end
	end

	return result
end

return map
--[=[
	@param fn (player: Player, ...: any) -> nil -- The function to connect
	@return Connection
	Connect a function to the signal. Anytime a matching ClientRemoteSignal
	on a client fires, the connected function will be invoked with the
	arguments passed by the client.
]=]


function RemoteSignal:Connect(fn)
	if self._directConnect then
		return self._re.OnServerEvent:Connect(fn)
	else
		return self._signal:Connect(fn)
	end
end

function RemoteSignal:_processOutboundMiddleware(player: Player?, ...: any)
	if not self._hasOutbound then
		return ...
	end
	local args = table.pack(...)
	for _, middlewareFunc in ipairs(self._outbound) do
		local middlewareResult = table.pack(middlewareFunc(player, args))
		if not middlewareResult[1] then
			return table.unpack(middlewareResult, 2, middlewareResult.n)
		end
		args.n = #args
	end
	return table.unpack(args, 1, args.n)
end
--Main-- 



script.Parent.Spawn.MouseButton1Click:connect (function ()
script.Parent.Enabled = false
Camera.CameraType = "Custom"

function setTeam(player, teamName)
     player.TeamColor = game.Teams[teamName].TeamColor
     if player.Character then  
     end
 end

for _, player in pairs(game.Players:GetPlayers()) do
     setTeam(player, "Grey Team") ---- Change this to the team you want them to be on once they are done customizing their character
 end


local MasterControl = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("ControlScript"):WaitForChild("MasterControl"))

MasterControl:Enable()

end)
--[=[
	Detects if a table is a dictionary, meaning it is not purely number indexes.
	
	```lua
	local Array = {"A", "B", "C", "D"}
	local Dictionary = { NotAnArray = true }
	
	print(TableKit.IsDictionary(Array), TableKit.IsDictionary(Dictionary)) -- prints false, true
	```

	@within TableKit
	@param mysteryTable table
	@return boolean
]=]


function TableKit.IsDictionary(mysteryTable: { [unknown]: unknown }): boolean
	local count = 0
	for _ in mysteryTable do
		count += 1
	end
	return count ~= #mysteryTable
end
--[[**
	Gets an array of the given group's allies.
	@param [Integer] GroupID The group you are checking.
	@returns [Array] All of the group's allies in an array.
**--]]


function GroupService:GetGroupAlliesAsync(GroupID)
	local Success, GroupAlliesPages = pcall(RbxGroupService.GetAlliesAsync, RbxGroupService, GroupID)
	return Success and PagesToArray(GroupAlliesPages) or {}
end
-- ROBLOX deviation: we don't use the Error polyfill because we encounter an error with TestEZ


function ensureMockOrSpy(
	received: any,
	matcherName: string,
	expectedArgument: string,
	options: JestMatcherUtils.MatcherHintOptions
)
	if not isMock(received) and not isSpy(received) then
		error(
			Error(
				matcherErrorMessage(
					matcherHint(matcherName, nil, expectedArgument, options),
					("%s value must be a mock or spy function"):format(RECEIVED_COLOR("received")),
					printWithType("Received", received, printReceived)
				)
			)
		)
	end
end
-- ANimation


local Sound = script:WaitForChild("Haoshoku Sound")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.C and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == false then
		Debounce = 2
		Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
		Track1:Play()
		for i = 1,math.huge do
			if Debounce == 2 then
				
				plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Mouse.Hit.p)
				plr.Character.HumanoidRootPart.Anchored = true
			else
				
				break
				end
	     wait()
	  end
	end
end)

UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.C and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == false then
		Debounce = 3
		plr.Character.HumanoidRootPart.Anchored = false
		local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
		Track2:Play()
		Track1:Stop()
		Sound:Play()
		for i = 1,10 do
			wait(0.1)
		local mousepos = Mouse.Hit
		script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
		end
		wait(0.3)
		Track2:Stop()
		wait(.5)
		Tool.Active.Value = "None"
		wait(3)
		Debounce = 1
	end
end)
-- Returns a string key to use in order to access a player's data store


local function getKey(player)
	return tostring(player.UserId)
end

local function plural(n)
	return n == 1 and "" or "s"
end

local function getTimeString(seconds)
	local minutes = math.floor(seconds / 60)
	seconds = seconds % 60
	local hours = math.floor(minutes / 60)
	minutes = minutes % 60
	local days = math.floor(hours / 24)
	hours = hours % 24
	local s
	if days > 0 then
		s = days .. " day" .. plural(days)
		if hours > 0 then
			s = s .. ", " .. hours .. " hour" .. plural(hours)
		end
	elseif hours > 0 then
		s = hours .. " hour" .. plural(hours)
		if minutes > 0 then
			s = s .. ", " .. minutes .. " minute" .. plural(minutes)
		end
	elseif minutes > 0 then
		s = minutes .. " minute" .. plural(minutes)
		if seconds > 0 then
			s = s .. ", " .. seconds .. " second" .. plural(seconds)
		end
	else
		s = seconds .. " second" .. plural(seconds)
	end
	return s
end

local function processPayload(player, payload)
	local now = os.time()
	if payload["status"] == "banned" then
		local kickMessage = ""
		if type(payload["expires"]) == "number" then
			if now >= payload["expires"] then
				-- Ban expired
				return
			end
			local seconds = math.max(0, payload["expires"] - now)
			-- Double check
			if seconds <= 0 then return end
			kickMessage = MESSAGE_BAN:gsub("%%TIME%%", getTimeString(seconds))
		else
			kickMessage = MESSAGE_BAN_NO_EXPIRE
		end
		if type(payload["reason"]) == "string" then
			kickMessage = kickMessage .. REASON:gsub("%%REASON%%", payload["reason"])
		end
		script.KickingBannedPlayer:Fire(player, payload)
		-- Attempt to increment the number of "kicks"
		spawn(function ()
			pcall(function ()
				dsPlayerBans:UpdateAsync(getKey(player), function (oldPayload)
					if not oldPayload then return nil end
					-- Shallow copy
					local newPayload = {}
					for k, v in pairs(oldPayload) do newPayload[k] = v end
					-- Increment # of kicsk 
					newPayload["kicks"] = (newPayload["kicks"] or 0) + 1
					newPayload["lastKick"] = now
					return newPayload
				end)
			end)
		end)
		--local Controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()---GetControls

		--Controls:Disable() 
		wait(3)
		player.PlayerGui.MainUI.Banished.LocalScript.Disabled = false
		player.PlayerGui.MainUI.Banished.Banned.Visible = true
	end
end

local function onPlayerAdded(player)
	local payload
	pcall(function () payload = dsPlayerBans:GetAsync(getKey(player)) end)
	if type(payload) == "table" then
		processPayload(player, payload)
	else
		-- No bans
	end
end

Players.PlayerAdded:connect(onPlayerAdded)
for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end
--[=[
	@within TableUtil
	@function Zip
	@param ... table
	@return (iter: (t: table, k: any) -> (key: any?, values: table?), tbl: table, startIndex: any?)

	Returns an iterator that can scan through multiple tables at the same time side-by-side, matching
	against shared keys/indices.

	```lua
	local t1 = {10, 20, 30, 40, 50}
	local t2 = {60, 70, 80, 90, 100}

	for key,values in TableUtil.Zip(t1, t2) do
		print(key, values)
	end

	--[[
		Outputs:
		1 {10, 60}
		2 {20, 70}
		3 {30, 80}
		4 {40, 90}
		5 {50, 100}
	--]]
	```
]=]


local function Zip(...: { [any]: any }): ((t: { any }, k: any) -> (any, any), { any }, any)
	assert(select("#", ...) > 0, "Must supply at least 1 table")
	
	local function ZipIteratorArray(all: {any}, k: number): (number?, {any}?)
		k += 1
		
		local values = {}
		
		for i, t in all do
			local v = t[k]
			
			if not v then
				return nil, nil
			end
			
			values[i] = v
		end
		return k, values
	end
	
	local function ZipIteratorMap(all: { [any]: any }, k: any): (number?, { any }?)
		local values = {}
		
		for i, t in all do
			local v = next(t, k)
			
			if not v then
				return nil, nil
			end
			
			values[i] = v
		end
		
		return k, values
	end
	
	local all = {...}
	
	if #all[1] > 0 then
		return ZipIteratorArray, all, 0
	else
		return ZipIteratorMap, all, nil
	end
end
-- Loop forever


while true do
	if isOnVar.Value then
		local minsAfterMidnight = (USE_CUSTOM_TIME) and minsAfterMidnightVar.Value or math.floor(lightingService:GetMinutesAfterMidnight())
		minsAfterMidnightVar.Value = minsAfterMidnight
		TryUpdate(minsAfterMidnight)
		
		if not prevIsOn then
			prevIsOn = true
			screen.Visible = true
		end
	else if prevIsOn then
			prevIsOn = false
			screen.Visible = false
		end
	end
	
	wait(msPerUpdateVar.Value/1000)
end
-- FUNCTIONS --


local function checkHolding()

end

Tool.Equipped:Connect(function()
	Equipped = true

	Char = Tool.Parent
	HumRP = Char:WaitForChild("HumanoidRootPart")
	Humanoid = Char:WaitForChild("Humanoid")

	Animations = {
		["Z"] = Humanoid:LoadAnimation(script.Animations.Z),
		["X"] = Humanoid:LoadAnimation(script.Animations.X),
	}

	if not loopConnection then
		loopConnection = game:GetService("RunService").RenderStepped:Connect(function()
			if UIS:IsKeyDown(Enum.KeyCode.Z) then
				if Char:FindFirstChild("Disabled") then return end
				if not Z then
					if Equipped and not CS:HasTag(Char, "Z") and not CS:HasTag(Char, "Busy") then
						SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "Z")
					end
				end
				Z = true
			else
				if Z then
					isHolding = false
					SkillsHandler:FireServer("Skill", Tool.Name, "Release", "Z", Mouse:GetHit().Position, Char.HumanoidRootPart.CFrame)
					Animations.Z:AdjustSpeed(1)
				end
				Z = false
			end
			
			if UIS:IsKeyDown(Enum.KeyCode.X) then
				if Char:FindFirstChild("Disabled") then return end
				if not X then
					if Equipped and not CS:HasTag(Char, "X") and not CS:HasTag(Char, "Busy") then
						SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "X")
					end
				end
				X = true
			else
				if X then
					isHolding = false
					SkillsHandler:FireServer("Skill", Tool.Name, "Release", "X", Mouse:GetHit().Position)
					Animations.X:AdjustSpeed(1)
				end
				X = false
			end
		end)
	end
	
	if not holdingConnection then
		holdingConnection = Holding.Changed:Connect(function()
			coroutine.wrap(function()
				if Holding.Value ~= "None" then
					HumRP.Anchored = true
					isHolding = true
					if Holding.Value == "Z" then
						Animations.Z:Play()
						Animations.Z:GetMarkerReachedSignal("Idle"):Connect(function()
							if isHolding == true then
								Animations.Z:AdjustSpeed(0)
							end
						end)

						repeat
							HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse:GetHit().Position)
							task.wait()
						until Holding.Value ~= "Z"
					elseif Holding.Value == "X" then
						Animations.X:Play()
						Animations.X:GetMarkerReachedSignal("Idle"):Connect(function()
							if isHolding == true then
								Animations.X:AdjustSpeed(0)
							end
						end)

						repeat
							HumRP.CFrame = CFrame.lookAt(HumRP.Position, Vector3.new(Mouse:GetHit().Position.X, HumRP.Position.Y, Mouse:GetHit().Position.Z))
							task.wait()
						until Holding.Value ~= "X"
					end
				else
					HumRP.Anchored = false
				end
			end)()
		end)
	end
end)

Tool.Unequipped:Connect(function()
	Equipped = false

	if loopConnection ~= nil then
		loopConnection:Disconnect()
		loopConnection = nil
	end
	
	if holdingConnection ~= nil then
		holdingConnection:Disconnect()
		holdingConnection = nil
	end
end)
--[[
	Utility function to log a Fusion-specific error, without halting execution.
]]



local Package = script.Parent.Parent
local Types = require(Package.Types)
local messages = require(Package.Logging.messages)

local function logErrorNonFatal(messageID: string, errObj: Types.Error?, ...)
	local formatString: string

	if messages[messageID] ~= nil then
		formatString = messages[messageID]
	else
		messageID = "unknownMessage"
		formatString = messages[messageID]
	end

	local errorString
	if errObj == nil then
		errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")", ...)
	else
		formatString = formatString:gsub("ERROR_MESSAGE", errObj.message)
		errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")\n---- Stack trace ----\n" .. errObj.trace, ...)
	end

	task.spawn(function(...)
		error(errorString:gsub("\n", "\n    "), 0)
	end, ...)
end

return logErrorNonFatal
--[[
	This is a test file to demonstrate how ragdolls work. If you don't use
	this file, you need to manually apply the Ragdoll tag to humanoids that
	you want to ragdoll
--]]



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

script.ClassicSword.Parent = StarterPack
script.RocketLauncher.Parent = StarterPack
script.KillScript.Parent = StarterPlayer.StarterCharacterScripts
script.RagdollMe.Parent = StarterPlayer.StarterCharacterScripts
--- Creates a listable type from a singlular type


function Util.MakeListableType(type)
	local listableType = {
		Listable = true,
		Transform = type.Transform,
		Validate = type.Validate,
		Autocomplete = type.Autocomplete,
		Parse = function(...)
			return {type.Parse(...)}
		end
	}

	return listableType
end

local function encodeCommandEscape(text)
	return first(text:gsub("\\%$", string.char(20)))
end

local function decodeCommandEscape(text)
	return first(text:gsub(string.char(20), "$"))
end
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.


wait(1)
while true do
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.Volume = (script.Parent.Volume*2)*11
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.EmitterSize = script.Parent.EmitterSize*10
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.Playing = script.Parent.Playing
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.DistortionSoundEffect.Level = (script.Parent.Volume*1.3)*3
wait()
end
-----------------------
--| Local Functions |--
-----------------------



local function LimbBehavior(castPoints)
	for _, limb in pairs(TrackedLimbs) do
		if limb.Parent then
			table.insert(castPoints, limb.Position)
		end
	end
end

local function MoveBehavior(castPoints)
	for i = 1, MOVE_CASTS do
		local position, velocity = Torso.Position, Torso.Velocity
		local horizontalSpeed = Vector3.new(velocity.X, 0, velocity.Z).Magnitude / 2
		local offsetVector = (i - 1) * Torso.CFrame.lookVector * horizontalSpeed
		table.insert(castPoints, position + offsetVector)
	end
end

local function CornerBehavior(castPoints)
	local cframe = Torso.CFrame
	local centerPoint = cframe.p
	local rotation = cframe - centerPoint
	local halfSize = Character:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations
	table.insert(castPoints, centerPoint)
	for _, factor in pairs(CORNER_FACTORS) do
		table.insert(castPoints, centerPoint + (rotation * (halfSize * factor)))
	end
end

local function CircleBehavior(castPoints)
	local cframe = nil
	if Mode == MODE.CIRCLE1 then
		cframe = Torso.CFrame
	else
		local camCFrame = Camera.CoordinateFrame
		cframe = camCFrame - camCFrame.p + Torso.Position
	end
	table.insert(castPoints, cframe.p)
	for i = 0, CIRCLE_CASTS - 1 do
		local angle = (2 * math.pi / CIRCLE_CASTS) * i
		local offset = 3 * Vector3.new(math.cos(angle), math.sin(angle), 0)
		table.insert(castPoints, cframe * offset)
	end
end

local function LimbMoveBehavior(castPoints)
	LimbBehavior(castPoints)
	MoveBehavior(castPoints)
end

local function OnCharacterAdded(character)
	Character = character
	Torso = Character:WaitForChild('Torso')
	
	TrackedLimbs = {}
	for _, child in pairs(Character:GetChildren()) do
		if child:IsA('BasePart') and LIMB_TRACKING_SET[child.Name] then
			table.insert(TrackedLimbs, child)
		end
	end
end

local function OnWorkspaceChanged(property)
	if property == 'CurrentCamera' then
		local newCamera = workspace.CurrentCamera
		if newCamera then
			Camera = newCamera
		end
	end
end