Roblox/luau_corpus huggingface dataset:
--[[Susupension]]
	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.FSusMaxComp	= .1		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.RSusMaxComp	= .1		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= true			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Really black"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
--[=[
	Removes a prefix from a string if it exists
	@param str string
	@param prefix string
	@return string
]=]
function String.removePrefix(str: string, prefix: string): string
	if str:sub(1, #prefix) == prefix then
		return str:sub(#prefix + 1)
	else
		return str
	end
end
-- FIXME: This should be updated to be closer to the actual
-- `Object.preventExtensions` functionality in JS. This requires additional
-- support from the VM
local function preventExtensions<T>(t: Table): T
	local name = tostring(t)

	return (
			setmetatable(t, {
				__newindex = function(self, key, value)
					local message = ("%q (%s) is not a valid member of %s"):format(tostring(key), typeof(key), name)

					error(message, 2)
				end,
				__metatable = false,
			}) :: any
		) :: T
end

return preventExtensions
-- ㊗
function findTorso(pos)
	local torso = nil
	local dist = 100000
	local child = workspace:children()
	for i=1, #child do
		if child[i].className == "Model" then
			local h = child[i]:findFirstChild("Humanoid")
			if h ~= nil then
				local check = child[i]:findFirstChild("Head")
				if check ~= nil then
					if (check.Position - pos).magnitude < dist then
						torso = check
						dist = (check.Position - pos).magnitude
					end
				end
			end
		end
	end
	return torso
end

game:GetService("RunService").Stepped:Connect(function()
	local torso = findTorso(script.Parent.Position)
	if torso ~= nil then
		script.Parent.CFrame = CFrame.new(script.Parent.Position, torso.Position)
	end
end)
--[=[
	Attaches a `finally` handler to this Promise that discards the resolved value and returns the given value from it.

	```lua
		promise:finallyReturn("some", "values")
	```

	This is sugar for

	```lua
		promise:finally(function()
			return "some", "values"
		end)
	```

	@param ... any -- Values to return from the function
	@return Promise
]=]
function Promise.prototype:finallyReturn(...)
	local length, values = pack(...)
	return self:_finally(debug.traceback(nil, 2), function()
		return unpack(values, 1, length)
	end)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

while wait() do
	local nrstt = GetTorso(hroot.Position)
	if nrstt ~= nil and human.Health > 0 then -- if player detected	
		vars.Wandering.Value = false
		vars.Chasing.Value = true
		local function checkw(t)
			local ci = 3
			if ci > #t then
				ci = 3
			end
			if t[ci] == nil and ci < #t then
				repeat ci = ci + 1 wait() until t[ci] ~= nil
				return Vector3.new(1,0,0) + t[ci]
			else
				ci = 3
				return t[ci]
			end
		end
		
		path = pfs:FindPathAsync(hroot.Position, nrstt.Position)
		waypoint = path:GetWaypoints()
		local connection;
		
		local direct = Vector3.FromNormalId(Enum.NormalId.Front)
		local ncf = hroot.CFrame * CFrame.new(direct)
		direct = ncf.p.unit
		local rootr = Ray.new(hroot.Position, direct)
		local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
		
		if path and waypoint or checkw(waypoint) then
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
				human:MoveTo( checkw(waypoint).Position )
				human.Jump = false
			end
			
			if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
				connection = human.Changed:connect(function()
					human.Jump = true
				end)
				human:MoveTo( waypoint[4].Position )
			else
				human.Jump = false
			end
			
			hroot.Touched:connect(function(p)
				local bodypartnames = GetPlayersBodyParts(nrstt)
				if p:IsA'Part' and not p.Name == bodypartnames and phit and phit.Name ~= bodypartnames and phit:IsA'Part' and rootr:Distance(phit.Position) < 5 then
					connection = human.Changed:connect(function()
						human.Jump = true
					end)
				else
					human.Jump = false
				end
			end)
			
			if connection then
				connection:Disconnect()
			end
			
		else
			for i = 3, #waypoint do
				human:MoveTo( waypoint[i].Position )	
			end
		end
		path = nil
		waypoint = nil
	elseif nrstt == nil then -- if player not detected
		vars.Wandering.Value = false
		vars.Chasing.Value = false
		CchaseName = nil
		path = nil
		waypoint = nil
		human.MoveToFinished:Wait()
	end
end
--print("building and not player")
target = nearestBuilding
targetType = nearestBuilding.ClassName
lastLock = tick()

else
--------------------
--| Script Logic |--
--------------------

VipDoor.Touched:connect(OnTouched)

while true do
	RemoveOldTouches()
	wait(1/30)
end
--[[Brakes]]
	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 15000		-- Front brake force
	Tune.RBrakeForce	= 15000		-- Rear brake force
	Tune.PBrakeForce	= 50000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--[=[
	Returns a brio that dies whenever the first Brio in the list
	dies. The value of the Brio is the `...` value.

	@param brios {Brio<T>}
	@param ... U
	@return Brio<U>
]=]
function BrioUtils.first(brios, ...)
	for _, brio in pairs(brios) do
		if Brio.isBrio(brio) then
			if brio:IsDead() then
				return Brio.DEAD
			end
		end
	end

	local maid = Maid.new()
	local topBrio = Brio.new(...)

	for _, brio in pairs(brios) do
		if Brio.isBrio(brio) then
			maid:GiveTask(brio:GetDiedSignal():Connect(function()
				topBrio:Kill()
			end))
		end
	end

	maid:GiveTask(topBrio:GetDiedSignal():Connect(function()
		maid:DoCleaning()
	end))

	return topBrio
end
-- functions

local function Display(text, sound)
	script.BeepSound:Play()
	
	INFO_GUI.Visible			= true
	INFO_GUI.Position			= UDim2.new(0.5, 0, 0.15, 0)
	INFO_GUI.InfoLabel.TextTransparency			= 1
	INFO_GUI.InfoLabel.TextStrokeTransparency	= 1
	INFO_GUI.InfoLabel.Text		= text
	
	INFO_GUI.BackgroundLabel.Size		= UDim2.new(0, 0, 1, 0)
	
	if sound then
		if script:FindFirstChild(sound .. "Sound") then
			script[sound .. "Sound"]:Play()
		end
	end
	
	local openInfo	= TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
	local closeInfo	= TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
	
	local openTweenA	= TweenService:Create(INFO_GUI.InfoLabel, openInfo, {TextTransparency = 0; TextStrokeTransparency = 0; Position = UDim2.new(0.5, 0, 0.2, 0)})
	local openTweenB	= TweenService:Create(INFO_GUI.BackgroundLabel, openInfo, {Size = UDim2.new(1, 0, 1, 0)})
	
	openTweenA:Play()
	openTweenB:Play()
	
	wait(5)
	
	local closeTweenA	= TweenService:Create(INFO_GUI.InfoLabel, closeInfo, {TextTransparency = 1; TextStrokeTransparency = 1; Position = UDim2.new(0.5, 0, 0.15, 0)})
	local closeTweenB	= TweenService:Create(INFO_GUI.BackgroundLabel, closeInfo, {Size = UDim2.new(0, 0, 1, 0)})
	
	closeTweenA:Play()
	closeTweenB:Play()
	
	wait(0.5)
	INFO_GUI.Visible	= false
end
--Wheelie tune
local WheelieD = 2
local WheelieTq = 85
local WheelieP = 5
local WheelieMultiplier = 1.5
local WheelieDivider = 2
-------------------------
function onClicked()
R.Function1.Disabled = true
R.Function2.Disabled = false
R.BrickColor = BrickColor.new("Institutional white")
N.One1.BrickColor = BrickColor.new("Really black")
N.One2.BrickColor = BrickColor.new("Really black")
N.One4.BrickColor = BrickColor.new("Really black")
N.One8.BrickColor = BrickColor.new("Really black")
N.Three4.BrickColor = BrickColor.new("Really black")
N.Four1.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--[[
	Constructs a new Promise with the given initializing callback.

	This is generally only called when directly wrapping a non-promise API into
	a promise-based version.

	The callback will receive 'resolve' and 'reject' methods, used to start
	invoking the promise chain.

	For example:

		local function get(url)
			return Promise.new(function(resolve, reject)
				spawn(function()
					resolve(HttpService:GetAsync(url))
				end)
			end)
		end

		get("https://google.com")
			:andThen(function(stuff)
				print("Got some stuff!", stuff)
			end)
]]
function Promise.new(callback)
	local promise = {
		-- Used to locate where a promise was created
		_source = debug.traceback(),

		-- A tag to identify us as a promise
		_type = "Promise",

		_status = Promise.Status.Started,

		-- A table containing a list of all results, whether success or failure.
		-- Only valid if _status is set to something besides Started
		_value = nil,

		-- If an error occurs with no observers, this will be set.
		_unhandledRejection = false,

		-- Queues representing functions we should invoke when we update!
		_queuedResolve = {},
		_queuedReject = {},
	}

	setmetatable(promise, Promise)

	local function resolve(...)
		promise:_resolve(...)
	end

	local function reject(...)
		promise:_reject(...)
	end

	local ok, err = wpcall(callback, resolve, reject)

	if not ok and promise._status == Promise.Status.Started then
		reject(err)
	end

	return promise
end
--[=[
	Yields the current thread until the given Promise completes. Returns the values that the promise resolved with.

	```lua
	local worked = pcall(function()
		print("got", getTheValue():expect())
	end)

	if not worked then
		warn("it failed")
	end
	```

	This is essentially sugar for:

	```lua
	select(2, assert(promise:await()))
	```

	**Errors** if the Promise rejects or gets cancelled.

	@error any -- Errors with the rejection value if this Promise rejects or gets cancelled.
	@yields
	@return ...any -- The values the Promise resolved with.
]=]
function Promise.prototype:expect()
	return expectHelper(self:awaitStatus())
end
-- Decompiled with the Synapse X Luau decompiler.

script.Parent.MouseButton1Down:Connect(function()
	script.Parent.Parent.Parent.AlienAnimationREAL.Fired:Fire();
end);
--WalkSpeedsHere!

local WalkSpeedWhileCrouching = 5
local CurrentWalkSpeed = 16
--[[**
	ensures Roblox RaycastParams type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.RaycastParams = t.typeof("RaycastParams")
------//Low Ready Animations
self.RightLowReady = CFrame.new(-.9, 1.25, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftLowReady = CFrame.new(1,1,-0.6) * CFrame.Angles(math.rad(-45),math.rad(15),math.rad(-25));

self.RightElbowLowReady = CFrame.new(0,-0.45,-.25) * CFrame.Angles(math.rad(-80), math.rad(0), math.rad(0));
self.LeftElbowLowReady = CFrame.new(0,0,0)  * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));

self.RightWristLowReady = CFrame.new(0,0,0.15) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0));
self.LeftWristLowReady = CFrame.new(0,0,0)  * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
--CONFIG VARIABLES
local tweenTime = 20
local closeWaitTime = 3
local easingStyle = Enum.EasingStyle.Quad
local easingDirection = Enum.EasingDirection.InOut
local repeats = 0
local reverse = false
local delayTime = 0
--- Update the text entry label
function Window:UpdateLabel()
	Entry.TextLabel.Text = `{Player.Name}@{self.Cmdr.PlaceName}$`
end
--Weld stuff here

MakeWeld(car.Misc.Wheel.W,car.DriveSeat,"Motor").Name="W"
ModelWeld(misc.Wheel.Parts,misc.Wheel.W)

MakeWeld(misc.Popups.Hinge, car.DriveSeat,"Motor",.1)
ModelWeld(misc.Popups.Parts, misc.Popups.Hinge)
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 

function updatechar()
	
	for _, v in pairs(character:GetChildren())do
		if CanViewBody then
			if v.Name == 'Head' then
				v.LocalTransparencyModifier = 1
				v.CanCollide = false
				v.face.LocalTransparencyModifier = 1
			end
		else
			if v:IsA'Part' or v:IsA'UnionOperation' or v:IsA'MeshPart' then
				v.LocalTransparencyModifier = 1
				v.CanCollide = false
			end
		end
		if v:IsA'Accessory' then
			v:FindFirstChild('Handle').LocalTransparencyModifier = 1
			v:FindFirstChild('Handle').CanCollide = false
		end
		if v:IsA'Hat' then
			v:FindFirstChild('Handle').LocalTransparencyModifier = 1
			v:FindFirstChild('Handle').CanCollide = false
		end

	end
	
end
--Don't modify this script unless you really know what you're doing.

local WaitFor = (function(parent, child_name)
	local found = parent:FindFirstChild(child_name)
	while found == nil do
		parent.ChildAdded:wait()
		found = parent:FindFirstChild(child_name)
		if found then break end
	end
	return found
end)

local last = { neckC1 = nil, rshoC0 = nil, lshoC0 = nil, rhipC0 = nil, lhipC0 = nil }

local ApplyModifications = (function(weld, char)
	local torso = WaitFor(char, "Torso")
	local neck = WaitFor(torso, "Neck")
	local rsho = WaitFor(torso, "Right Shoulder")
	local lsho = WaitFor(torso, "Left Shoulder")
	local rhip = WaitFor(torso, "Right Hip")
	local lhip = WaitFor(torso, "Left Hip")

	local config = script.Parent.Configuration
	local head_ang = config["Head Angle"].Value
	local legs_ang = config["Legs Angle"].Value
	local arms_ang = config["Arms Angle"].Value
	local sit_ang  = config["Sitting Angle"].Value
	local sit_pos  = config["Sitting Position"].Value

	--First adjust sitting position and angle
	--Add 90 to the angle because that's what most people will be expecting.
	weld.C1 = weld.C1 * CFrame.fromEulerAnglesXYZ(math.rad((sit_ang) + 90), 0, 0)
	
	weld.C0 = CFrame.new(sit_pos)

	last.neckC1 = neck.C1
	last.rshoC0 = rsho.C0
	last.lshoC0 = lsho.C0
	last.rhipC0 = rhip.C0
	last.lhipC0 = lhip.C0

	--Now adjust the neck angle.
	neck.C1 = neck.C1 * CFrame.fromEulerAnglesXYZ(math.rad(head_ang), 0, 0)
	

	--Now adjust the arms angle.
	rsho.C0 = rsho.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(arms_ang))
	lsho.C0 = lsho.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(-arms_ang))
	

	--Now the legs
	rhip.C0 = rhip.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(legs_ang))
	lhip.C0 = lhip.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(-legs_ang))
end)

local RevertModifications = (function(weld, char)
	--Any modifications done in ApplyModifications have to be reverted here if they
	--change any welds - otherwise people will wonder why their head is pointing the wrong way.

	local torso = WaitFor(char, "Torso")
	local neck = WaitFor(torso, "Neck")
	local rsho = WaitFor(torso, "Right Shoulder")
	local lsho = WaitFor(torso, "Left Shoulder")
	local rhip = WaitFor(torso, "Right Hip")
	local lhip = WaitFor(torso, "Left Hip")


	--Now adjust the neck angle.
	neck.C1 = last.neckC1 or CFrame.new()

	rsho.C0 = last.rshoC0 or CFrame.new()
	lsho.C0 = last.lshoC0 or CFrame.new()

	rhip.C0 = last.rhipC0 or CFrame.new()
	lhip.C0 = last.lhipC0 or CFrame.new()

	weld:Destroy()
end)

script.Parent.ChildAdded:connect(function(c)
	if c:IsA("Weld") then
		local character = nil
		if c.Part1 ~= nil and c.Part1.Parent ~= nil and c.Part1.Parent:FindFirstChild("Humanoid") ~= nil then
			character = c.Part1.Parent
		else return end
		ApplyModifications(c, character)
	end
end)

script.Parent.ChildRemoved:connect(function(c)
	if c:IsA("Weld") then
		local character = nil
		if c.Part1 ~= nil and c.Part1.Parent ~= nil and c.Part1.Parent:FindFirstChild("Humanoid") ~= nil then
			character = c.Part1.Parent
		else return end
		RevertModifications(c, character)
	end
end)
--This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character.
-- util

function waitForChild(parent, childName)
	local child = parent:findFirstChild(childName)
	if child then return child end
	while true do
		child = parent.ChildAdded:wait()
		if child.Name==childName then return child end
	end
end
-- Small bug fix where the sound would start playing after the player joined
player.CharacterAdded:Connect(function()
	task.wait(1)
	if currentSound.IsPlaying then
		currentSound:Stop()
	end
end)
--[=[
	@param defaultFn () -> any
	@return value: any
	If the option holds a value, returns the value. Otherwise, returns the
	result of the `defaultFn` function.
]=]
function Option:UnwrapOrElse(defaultFn)
	if self:IsSome() then
		return self:Unwrap()
	else
		return defaultFn()
	end
end
--[[
	
	local base64 = Base64.new()
	
	Example:
	
	local myEncodedWord = base64:Encode("Hello")
	
	print(myEncodedWord)
	
	-- outputs: SGVsbG8=
	
	print(base64:Decode(myEncodedWord))
	
	-- outputs: Hello

--]]

local Alphabet = {}
local Indexes = {}

for Index = 65, 90 do table.insert(Alphabet, Index) end -- A-Z
for Index = 97, 122 do table.insert(Alphabet, Index) end -- a-z
for Index = 48, 57 do table.insert(Alphabet, Index) end -- 0-9

table.insert(Alphabet, 43) -- +
table.insert(Alphabet, 47) -- /

for Index, Character in ipairs(Alphabet) do
	Indexes[Character] = Index
end

local Base64 = {
	ClassName = "Base64";
	__tostring = function(self) return self.ClassName end;
}

Base64.__index = Base64

local bit32_rshift = bit32.rshift
local bit32_lshift = bit32.lshift
local bit32_band = bit32.band

function Base64.new()
	return setmetatable({}, Base64)
end
-- services
local Rep = game:GetService("ReplicatedStorage")
local Run = game:GetService("RunService")
local DS = game:GetService("DataStoreService")
local MS = game:GetService("MarketplaceService")
local Debris = game:GetService("Debris")
local Physics = game:GetService("PhysicsService")
local CS = game:GetService("CollectionService")
local HTTP = game:GetService("HttpService")
local SS = game:GetService("ServerStorage")
local SSS = game:GetService("ServerScriptService")
local UIS = game:GetService("UserInputService")


local GU = require(Rep.Modules.GameUtil)

Run.Heartbeat:connect(function()
	local minutesAfterMidnight = Rep.Constants.MinutesAfterMidnight.Value
	local dayPhase,phaseData = GU.GetDayPhase()
	local amount = phaseData.tock*10
	
	Rep.Constants.MinutesAfterMidnight.Value = math.clamp(minutesAfterMidnight+amount,0,1440)
	
	if Rep.Constants.MinutesAfterMidnight.Value >= 1440 then
		Rep.Constants.MinutesAfterMidnight.Value = 0
	end
	
end)
----------------------------------------------------------------------------------------------------
--------------------=[ CFRAME ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
	,EnableHolster = false
	,HolsterTo = 'Torso'				 -- Put the name of the body part you wanna holster to
	,HolsterPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
	
	,RightArmPos = CFrame.new(-0.85, -0.2, -1.2) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))	--Server
	,LeftArmPos = CFrame.new(1.2,-0.2,-1.4) * CFrame.Angles(math.rad(-100),math.rad(25),math.rad(-20))	--server
	
	,ServerGunPos = CFrame.new(-.3, -1, -0.4) * CFrame.Angles(math.rad(-90), math.rad(-90), math.rad(0))
	,GunPos = CFrame.new(0.15, -0.15, 1) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
	
	,RightPos = CFrame.new(-.9, .1, -1.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))	--Client
	,LeftPos = CFrame.new(1.2,-0.2,-1.2) * CFrame.Angles(math.rad(-120),math.rad(35),math.rad(-5))	--Client
}

return Config
--- On Fire
Signal.Fired = function(eventName)
	--- Variables
	eventName = string.lower(eventName)

	--- Get/create event
	local event = GetEvent(eventName)

	--
	return event.Event
end
--[[
	Similar to finally, except rejections are propagated through it.
]]
function Promise.prototype:done(finallyHandler)
	assert(
		finallyHandler == nil or type(finallyHandler) == "function" or finallyHandler.__call ~= nill,
		string.format(ERROR_NON_FUNCTION, "Promise:done")
	)
	return self:_finally(debug.traceback(nil, 2), finallyHandler, true)
end
-- tween the sound to the speed
local tween = game:GetService("TweenService"):Create(waterSound,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{["Volume"] = math.clamp(speed/maxSpeed,0,1)}) -- end of tweencreate
tween:Play()
end
--local part,pos,norm,mat = workspace:FindPartOnRay(ray,shelly)
--shelly:MoveTo(Vector3.new(shelly.PrimaryPart.Position.X,pos.Y+2.25,shelly.PrimaryPart.Position.Z))
--bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)
until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
---------------------------------------------------------------------

local RotatedRegion = {}
RotatedRegion.__index = RotatedRegion


local tNewRegion = t.tuple( t.CFrame, t.Vector3 )
function RotatedRegion.new( centerCFrame: CFrame, size: Vector3 )
    assert( tNewRegion(centerCFrame, size) )

    local self = setmetatable( {}, RotatedRegion )
    self.SurfaceCountsAsCollision = true
    self.CFrame = centerCFrame
    self.Size = size
    self.Planes = {}

    for _, enum in next, Enum.NormalId:GetEnumItems() do
        local localNormal = Vector3.FromNormalId( enum )
        local worldNormal = self.CFrame:VectorToWorldSpace( localNormal )
        local distance = ( localNormal * self.Size/2 ).Magnitude
        local point = self.CFrame.Position + worldNormal * distance
        table.insert( self.Planes, {
            Normal = worldNormal;
            Point = point;
        } )
    end

    return self
end


local tVector3 = t.Vector3
function RotatedRegion:IsInRegion( vector3 )
    assert( tVector3(vector3) )

    for _, plane in next, ( self.Planes ) do
        local relativePosition = vector3 - plane.Point
        if ( self.SurfaceCountsAsCollision ) then
            if ( relativePosition:Dot(plane.Normal) >= 0 ) then
                return false
            end
        else
            if ( relativePosition:Dot(plane.Normal) > 0 ) then
                return false
            end
        end
    end

    return true, ( vector3 - self.CFrame.Position ).Magnitude
end


function RotatedRegion:GetPlayersInRegion()
    local players = {}
    for _, player in pairs( Players:GetPlayers() ) do
        local rootPart = player.Character and player.Character:FindFirstChild( "HumanoidRootPart" )
        if ( rootPart ) then
            if ( self:IsInRegion(rootPart.Position) ) then
                table.insert( players, player )
            end
        end
    end
    return players
end


function RotatedRegion:CountPlayersInRegion()
    return #( self:GetPlayersInRegion() )
end


return RotatedRegion