Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	-- make a splat
	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
	end
--]]



	if humanoid then
		if game.Players:FindFirstChild(humanoid.Parent.Name).TeamColor~=ball.BrickColor then
			tagHumanoid(humanoid)
			humanoid:TakeDamage(damage)
			wait(2)
			untagHumanoid(humanoid)
		end
	end

	connection:disconnect()
	ball.Parent = nil
end

function tagHumanoid(humanoid)
	-- todo: make tag expire
	local tag = ball:findFirstChild("creator")
	if tag ~= nil then
		local new_tag = tag:clone()
		new_tag.Parent = humanoid
	end
end


function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end

connection = ball.Touched:connect(onTouched)

wait(8)
ball.Parent = nil
-- functions



function onRunning(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	pose = "Jumping"
end

function onClimbing()
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function moveJump()
	RightShoulder.MaxVelocity = 0.5
	LeftShoulder.MaxVelocity = 0.5
  RightShoulder.DesiredAngle = (3.14)
	LeftShoulder.DesiredAngle = (-3.14)
	RightHip.DesiredAngle = (0)
	LeftHip.DesiredAngle = (0)
end
----------------------------------------------------------------------------
---  Functions  ------------------------------------------------------------
----------------------------------------------------------------------------



local c = script.DepthOfField:Clone()

c.Parent = game.Lighting

local function DestroyDroplet(d)
	wait(Random_:NextNumber(1,1.5))

	-- Proper GC
	for _, Child in ipairs(d:GetChildren()) do
		local Index = table.find(ignoreList, Child)
		if Index then
			ignoreList[Index] = ignoreList[IgnoreLength]
			ignoreList[IgnoreLength] = nil
			IgnoreLength = IgnoreLength - 1
		end
	end

	local Index = table.find(ignoreList, d)
	if Index then
		ignoreList[Index] = ignoreList[IgnoreLength]
		ignoreList[IgnoreLength] = nil
		IgnoreLength = IgnoreLength - 1
	end

	d:Destroy()
end
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.


script.Parent.Parent.Parent.Parent.Parent.Scripts.Amp.Changed:Connect(function()
script.Parent.Sound:Play()
if script.Parent.Parent.Parent.Parent.Parent.Scripts.Amp.Value == true then
if (math.random(1,50)) ~= 1 then
script.Parent.Parent.On.Value = true
script.Parent.Parent.Parent.Parent.Parent.Scripts.AmpsActive.Value = (script.Parent.Parent.Parent.Parent.Parent.Scripts.AmpsActive.Value + 1)
end
else
script.Parent.Parent.On.Value = false
script.Parent.Parent.Parent.Parent.Parent.Scripts.AmpsActive.Value = (script.Parent.Parent.Parent.Parent.Parent.Scripts.AmpsActive.Value - 1)
end
end)
-- same as jump for now



function moveFreeFall()
	RightShoulder.MaxVelocity = 0.5
	LeftShoulder.MaxVelocity = 0.5
	RightShoulder:SetDesiredAngle(3.14)
	LeftShoulder:SetDesiredAngle(-3.14)
	RightHip:SetDesiredAngle(0)
	LeftHip:SetDesiredAngle(0)
end

function moveSit()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder:SetDesiredAngle(3.14 /2)
	LeftShoulder:SetDesiredAngle(-3.14 /2)
	RightHip:SetDesiredAngle(3.14 /2)
	LeftHip:SetDesiredAngle(-3.14 /2)
end

function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

function animateTool()
	
	if (toolAnim == "None") then
		RightShoulder:SetDesiredAngle(1.57)
		return
	end

	if (toolAnim == "Slash") then
		RightShoulder.MaxVelocity = 0.5
		RightShoulder:SetDesiredAngle(0)
		return
	end

	if (toolAnim == "Lunge") then
		RightShoulder.MaxVelocity = 0.5
		LeftShoulder.MaxVelocity = 0.5
		RightHip.MaxVelocity = 0.5
		LeftHip.MaxVelocity = 0.5
		RightShoulder:SetDesiredAngle(1.57)
		LeftShoulder:SetDesiredAngle(1.0)
		RightHip:SetDesiredAngle(1.57)
		LeftHip:SetDesiredAngle(1.0)
		return
	end
end

function move(time)
	local amplitude
	local frequency
  
	if (pose == "Jumping") then
		moveJump()
		return
	end

	if (pose == "FreeFall") then
		moveFreeFall()
		return
	end
 
	if (pose == "Seated") then
		moveSit()
		return
	end

	local climbFudge = 0
	
	if (pose == "Running") then
		RightShoulder.MaxVelocity = 0.15
		LeftShoulder.MaxVelocity = 0.15
		amplitude = 1
		frequency = 9
	elseif (pose == "Climbing") then
		RightShoulder.MaxVelocity = 0.5 
		LeftShoulder.MaxVelocity = 0.5
		amplitude = 1
		frequency = 9
		climbFudge = 3.14
	else
		amplitude = 0.1
		frequency = 1
	end

	desiredAngle = amplitude * math.sin(time*frequency)

	RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
	LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
	RightHip:SetDesiredAngle(-desiredAngle)
	LeftHip:SetDesiredAngle(-desiredAngle)


	local tool = getTool()

	if tool then
	
		animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()

		
	else
		toolAnim = "None"
		toolAnimTime = 0
	end
end
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.


local dayLength = 12

local cycleTime = dayLength*60
local minutesInADay = 24*60

local lighting = game:GetService("Lighting")

local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime

local timeRatio = minutesInADay / cycleTime

if dayLength == 0 then
	dayLength = 1
end

repeat
	local currentTime = tick()
	
	if currentTime > endTime then
		startTime = endTime
		endTime = startTime + cycleTime
	end
	
	lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
	wait(1/15)
until false
-- This will assume whether or not the object is a Promise or a regular object.


function Janitor.__index:AddObject(Object)
	local Id = newproxy(false)
	--[[
	if Promise.is(Object) then
		if Object:getStatus() == Promise.Status.Started then
			local NewPromise = self:Add(Promise.resolve(Object), "cancel", Id)
			NewPromise:finallyCall(self.Remove, self, Id)
			return NewPromise, Id
		else
			return Object
		end
	else
		return self:Add(Object, false, Id), Id
	end---]]
	return self:Add(Object, false, Id), Id
end

Janitor.__index.GiveObject = Janitor.__index.AddObject
-- these should not be undefined


export type DoneTakingTestFn = (this: TestContext | nil, done: DoneFn) -> ValidTestReturnValues
export type PromiseReturningTestFn = (this: TestContext | nil) -> TestReturnValue
export type GeneratorReturningTestFn = (this: TestContext | nil) -> TestReturnValueGenerator

export type TestName = string
export type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn
export type ConcurrentTestFn = () -> TestReturnValuePromise
export type BlockFn = () -> ()
export type BlockName = string
export type HookFn = TestFn

export type Col = any
export type Row = Array<Col>
export type Table = Array<Row>
export type ArrayTable = Table | Row
export type TemplateTable = TemplateStringsArray
export type TemplateData = Array<any>
--	print(animName .. " " .. idx .. " [" .. origRoll .. "]")


	
	local anim = animTable[animName][idx].anim

	-- switch animation		
	if (anim ~= currentAnimInstance) then
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
	
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		 
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:Disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:Connect(keyFrameReachedFunc)
		
	end

end
--[[ 
INSTRUCTIONS: Place both teleporter1a and teleporter1b in the same directory 
(e.g. both in workspace directly, or both directly in the same group or model) 
Otherwise it wont work. Once youve done that, jump on the teleporter to teleport to the other. 
If you want more than one set of teleporters I will be adding more types in the future. 

Send me requests and ideas - Demotico. 
--]]
--[[ LawlR fix ]]

--

local ds = game:GetService("Debris")
local ps = game:GetService("Players")

local rng = Random.new()

local potato = script.Parent
local potatoOwner = potato:WaitForChild("Owner").Value

local ownerName = potatoOwner.Name
local dmg = 49
local lifetime = 500


local function tagHum(hum)
	local tag = Instance.new("ObjectValue")
	tag.Name = "creator"
	tag.Value = potatoOwner
	tag.Parent = hum
	ds:AddItem(tag, 2)
end

local function isTeamMate(hitPlr)
	return (hitPlr and potatoOwner and not hitPlr.Neutral and not potatoOwner.Neutral and hitPlr.TeamColor == potatoOwner.TeamColor)
end


potato.Touched:Connect(function(hit)
	local hitHum = hit.Parent:FindFirstChildWhichIsA("Humanoid") or hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid")
	if hitHum and hitHum.Health > 0 then
		local hitChr = hitHum.Parent
		if hitChr then
			if hitChr.Name ~= ownerName then
				local hitPlr = ps:GetPlayerFromCharacter(hitChr)
				if hitPlr and isTeamMate(hitPlr) then
					return
				end
				tagHum(hitHum)
				hitHum:TakeDamage(dmg)
				hitHum.WalkSpeed = 0
				wait(3)
				hitHum.WalkSpeed = 16
			end
		end
	end
end)

ds:AddItem(potato, lifetime)
--[[ 
 Better don't change anything. This script is WIP v.0.4
 This thing still glitchy and still needs an improvement

 Don't edit pass this line you may break the whole script ]]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


function StartSound()
NightTheme:Pause()
Found:Play()
FlashEffect.BackgroundTransparency = 0.6
wait(0.4)
ScreenShake.Disabled = false
FlashEffect.BackgroundTransparency = 1
RakeTheme:Play()	
end

function StopSound()
ScreenShake.Disabled = true
FlashEffect.BackgroundTransparency = 1
RakeTheme:Stop()
NightTheme:Play()
Camera.FieldOfView = 70
end

function UpdateNightThemeID()
local RandomNTIDS = math.random(1,#NightThemeIDS)
local ChosenNTID = NightThemeIDS[RandomNTIDS]
--[[
	Reference renderer intended for use in tests as well as for documenting the
	minimum required interface for a Roact renderer.
]]



local NoopRenderer = {}

function NoopRenderer.isHostObject(target)
	-- Attempting to use NoopRenderer to target a Roblox instance is almost
	-- certainly a mistake.
	return target == nil
end

function NoopRenderer.mountHostNode(_reconciler, _node) end

function NoopRenderer.unmountHostNode(_reconciler, _node) end

function NoopRenderer.updateHostNode(_reconciler, node, _newElement)
	return node
end

return NoopRenderer
--Leave script alone!




game.Players.PlayerAdded:Connect(function(plr)
	wait()
	local SunFX = script.LensFlareGui:Clone()
	SunFX.Parent = plr.PlayerGui
end)



print('Voxel: SEGI LIGHTING loaded..')

wait(2)
script.Beep:Play()

Lighting = game:GetService("Lighting")

wait(0.1)

Lighting.Brightness = 3
Lighting.ExposureCompensation = 1.2

Lighting.ShadowSoftness = 0.2

Lighting.OutdoorAmbient = Color3.new(139/255, 139/255, 139/255)
Lighting.Ambient = Color3.new(2/255, 2/255, 2/255)

SunFlare = Instance.new("SunRaysEffect", Lighting)
SunFlare.Intensity = 0.059
SunFlare.Spread = 0.356

ColorCorrection = Instance.new("ColorCorrectionEffect", Lighting)
ColorCorrection.TintColor = Color3.new(229/255, 231/255, 255/255)
ColorCorrection.Contrast = 0.1
ColorCorrection.Brightness = 0
ColorCorrection.Saturation = 0.1


Lighting.FogEnd = 2500
Lighting.FogStart = 0
Lighting.FogColor = Color3.new(160/255, 214/255, 255/255)
-- Public Functions


function UpgradeManager:AddUpgrade(player)
	local stats = player:WaitForChild("stats")
	local points = stats:WaitForChild(GameSettings.pointsName)
	local upgrades = stats:WaitForChild(GameSettings.upgradeName)
	upgrades.Value = upgrades.Value + 1
	self:SetWalkspeedToCurrentUpgrade(player)
	ParticleController:CreateUpgradeParticle(player)
	
	DataStore:SetPoints(player, points.Value)
	DataStore:SetUpgrades(player, upgrades.Value)
end

function UpgradeManager:BuyUpgrade(player)
	local stats = player:WaitForChild("stats")
	local points = stats:WaitForChild(GameSettings.pointsName)
	local upgrades = stats:WaitForChild(GameSettings.upgradeName)
	
	local cost = GameSettings.upgradeCost(upgrades.Value)
	
	-- Check if the player can make the purchase and if so, allow them
	if points.Value >= cost then
		points.Value = points.Value - cost
		upgrades.Value = upgrades.Value + 1
		self:SetWalkspeedToCurrentUpgrade(player)
		
		DataStore:SetPoints(player, points.Value)
		DataStore:SetUpgrades(player, upgrades.Value)
		ParticleController:CreateUpgradeParticle(player)
	else
		-- Not enough points
	end
end

return UpgradeManager
--returns the wielding player of this tool


function getPlayer()
	local char = Tool.Parent
	return game:GetService("Players"):GetPlayerFromCharacter(Character)
end

function Toss(direction)
	local OriginalWalkSpeed = Humanoid.WalkSpeed
	OriginalWalkSpeed = OriginalWalkSpeed
	Humanoid.WalkSpeed = 0
	local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
	local spawnPos = Character.Head.Position
	spawnPos  = spawnPos + (direction * 5)
	Tool.Handle.Transparency = 1
	Object.Parent = workspace
	Object.Transparency = 1
	Object.Swing.Pitch = math.random(90, 110)/100
	Object.Swing:Play()
	Object.CanCollide = true
	Object.CFrame = Tool.Handle.CFrame
	Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
	Object.Fuse:Play()
	Object.Sparks.Enabled = true
	local rand = 11.25
	Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
	Object:SetNetworkOwner(getPlayer())
	local ScriptClone = DamageScript:Clone()
	ScriptClone.FriendlyFire.Value = FriendlyFire
	ScriptClone.Damage.Value = AttackDamage
	ScriptClone.Parent = Object
	ScriptClone.Disabled = false
	local tag = Instance.new("ObjectValue")
	tag.Value = getPlayer()
	tag.Name = "creator"
	tag.Parent = Object
	Humanoid.WalkSpeed = OriginalWalkSpeed
	Tool:Destroy()
	
end

Remote.OnServerEvent:Connect(function(player, mousePosition)
	if not AttackAble then return end
	AttackAble = false
	if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
		Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
	end
	local targetPos = mousePosition.p
	local lookAt = (targetPos - Character.Head.Position).unit
	Toss(lookAt)
	LeftDown = true
end)

function onLeftUp()
	LeftDown = false
end

Tool.Equipped:Connect(function()
	Character = Tool.Parent
	Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)

Tool.Unequipped:Connect(function()
	Character = nil
	Humanoid = nil
end)
--[=[
	Construct a new Promise that will be resolved or rejected with the given callbacks.

	If you `resolve` with a Promise, it will be chained onto.

	You can safely yield within the executor function and it will not block the creating thread.

	```lua
	local myFunction()
		return Promise.new(function(resolve, reject, onCancel)
			wait(1)
			resolve("Hello world!")
		end)
	end

	myFunction():andThen(print)
	```

	You do not need to use `pcall` within a Promise. Errors that occur during execution will be caught and turned into a rejection automatically. If `error()` is called with a table, that table will be the rejection value. Otherwise, string errors will be converted into `Promise.Error(Promise.Error.Kind.ExecutionError)` objects for tracking debug information.

	You may register an optional cancellation hook by using the `onCancel` argument:

	* This should be used to abort any ongoing operations leading up to the promise being settled.
	* Call the `onCancel` function with a function callback as its only argument to set a hook which will in turn be called when/if the promise is cancelled.
	* `onCancel` returns `true` if the Promise was already cancelled when you called `onCancel`.
	* Calling `onCancel` with no argument will not override a previously set cancellation hook, but it will still return `true` if the Promise is currently cancelled.
	* You can set the cancellation hook at any time before resolving.
	* When a promise is cancelled, calls to `resolve` or `reject` will be ignored, regardless of if you set a cancellation hook or not.

	@param executor (resolve: (...: any) -> (), reject: (...: any) -> (), onCancel: (abortHandler: () -> boolean)) -> ()
	@return Promise
]=]


function Promise.new(executor)
	return Promise._new(debug.traceback(nil, 2), executor)
end

function Promise:__tostring()
	return string.format("Promise(%s)", self._status)
end
--[[

Dax,

See the MeleeScript.

]]



local canmelee = true;
local tool = script.Parent;

function onKeyDown(key)
	key:lower();
	if key == "f" then
		if canmelee == false then
			return;
		end

		tool.Melee:play()

		canmelee = false;

		local rgrip = tool.Parent["Right Arm"].RightGrip;

		script.melee.Value = true;

		for i = 1,6 do
			rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(-0.55,0,0);
			wait();
		end

		wait(0.25);

		for i = 1, 6 do
			rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(0.55,0,0);
			wait();
		end

		script.melee.Value = false;

		wait(0.5);

		canmelee = true;
	end
end

function onSelect(mouse)
	mouse.KeyDown:connect(onKeyDown);
end


function blow(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	if not humanoid then return end
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid ~= hum and hum ~= nil and game.Players:playerFromCharacter(humanoid.Parent) and game.Players:playerFromCharacter(humanoid.Parent).TeamColor~=cc then
		tagHumanoid(humanoid, vPlayer)
		humanoid:TakeDamage(300)
		wait(1)
		untagHumanoid(humanoid)
	end
end


tool.Equipped:connect(onSelect);
---[[ Window Settings ]]


module.MinimumWindowSize = UDim2.new(0.3, 0, 0.25, 0)
module.MaximumWindowSize = UDim2.new(1, 0, 1, 0) -- Should always be less than the full screen size.
module.DefaultWindowPosition = UDim2.new(0, 0, 0, 0)
local extraOffset = (7 * 2) + (5 * 2) -- Extra chatbar vertical offset
module.DefaultWindowSizePhone = UDim2.new(0.5, 0, 0.5, extraOffset)
module.DefaultWindowSizeTablet = UDim2.new(0.4, 0, 0.3, extraOffset)
module.DefaultWindowSizeDesktop = UDim2.new(0.23, 0, 0.2, extraOffset)
--Button size


local ButtonSX = Button.Size.X.Scale
local ButtonSY = Button.Size.Y.Scale

Button.MouseEnter:Connect(function(x,y)
	--HolaMousee
	Button:TweenSize(
		UDim2.new(ButtonSX + 0.027 , 0,ButtonSY + 0.024, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		0.2,
		true
	)
end)

Button.MouseLeave:Connect(function(x,y)
	--AdiosMousee
	Button:TweenSize(
		UDim2.new(ButtonSX, 0,ButtonSY, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		0.2,
		true
	)
end)

Button.MouseButton1Down:Connect(function(x,y)
	--Holding mouse
	Button:TweenSize(
		UDim2.new(ButtonSX - 0.027 , 0,ButtonSY - 0.024 , 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		0.15,
		true
	)
end)

Button.MouseButton1Up:Connect(function(x,y)
	--Holding mouse
	Button:TweenSize(
		UDim2.new(ButtonSX + 0.027,0, ButtonSY + 0.024,0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		0.15,
		true
	)
end)
-- tweens a given object in the path made by the Bezier (cframe version)
-- works for any object that has the properties given by the property table


function Bezier:CreateCFrameTween(object: Instance | {[any]: any}, propertyTable: {any}, bezierTweenInfo: TweenInfo, RelativeToLength: boolean?): Tween
	
	-- check if there are enough points to calculate a cframe within the Bezier
	if #self.Points <= 1 then
		error("Bezier:CreateVector3Tween() only works if there are at least 2 BezierPoints in the Bezier!")
	end

	-- check if the object given is a valid object
	if typeof(object) ~= "Instance" and typeof(object) ~= "table" then
		error("Bezier:CreateCFrameTween() requires an Instance or a table as the first argument!")
	end

	-- check if the bezierTweenInfo given is a TweenInfo object
	if not (typeof(bezierTweenInfo) == "TweenInfo") then
		error("Bezier:CreateCFrameTween() requires a TweenInfo object as the third argument!")
	end

	-- check if the object given has the CFrame properties given
	local success, foundProperties = pcall(function()
		local foundProperties = true
		for _, propertyName in pairs(propertyTable) do
			if typeof(object[propertyName]) ~= "CFrame" and typeof(object[propertyName]) ~= "nil" then
				foundProperties = false
				break
			end
		end
		return foundProperties
	end)

	-- check if the properties were found
	if success and foundProperties then
		local tweenService = game:GetService("TweenService")
		local numValue = Instance.new("NumberValue")
		local tween = tweenService:Create(numValue, bezierTweenInfo, {Value = 1})
		local numValueChangedConnection
		tween.Changed:Connect(function(prop)
			if prop == "PlaybackState" then
				local playbackState = tween.PlaybackState
				if playbackState == Enum.PlaybackState.Playing then
					numValueChangedConnection = numValue.Changed:Connect(function(t)
						for _, propName in pairs(propertyTable) do
							local position = RelativeToLength and self:CalculatePositionRelativeToLength(t) or self:CalculatePositionAt(t)
							local derivative = RelativeToLength and self:CalculateDerivativeRelativeToLength(t) or self:CalculateDerivativeAt(t)
							object[propName] = CFrame.new(position, position + derivative)
						end
					end)
				else
					if numValueChangedConnection then
						numValueChangedConnection:Disconnect()
						numValueChangedConnection = nil
					end
				end
			end
		end)
		return tween
	else
		error("Bezier:CreateCFrameTween() requires a matching property table with CFrame or nil property names for the object as the second argument!")
	end
end
----------------------------------------------------------------------
--------------------[ GET WELD CFRAMES ]------------------------------
----------------------------------------------------------------------



for _, v in pairs(Gun:GetChildren()) do
	if v:IsA("BasePart") and v ~= Handle then
		if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
		if (not v:FindFirstChild("weldCF")) then
			local weldCF = Instance.new("CFrameValue")
			weldCF.Name = "weldCF"
			weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
			weldCF.Parent = v
		end
		if string.sub(v.Name, 1, 3) == "Mag" then
			if (not v:FindFirstChild("magTrans")) then
				local magTrans = Instance.new("NumberValue")
				magTrans.Name = "magTrans"
				magTrans.Value = v.Transparency
				magTrans.Parent = v
			end
		end
		v.Anchored = true
		v.CanCollide = false
	end
end
Handle.Anchored = false
Handle.CanCollide = true