Pinkstack/roblox-luau-corpus-text huggingface dataset:
--Motor = script.Parent.Motor



function Active()
	if Thermostat.Value == true and script.Parent.Parent.Coolmode.Value==true then
		wait(2)
		script.Parent.Blower.Value=true
		script.Parent.Burners.Value=false
		script.Parent.Inducer.Value=false
		
	elseif Thermostat.Value == true and script.Parent.Parent.Coolmode.Value==false then
		script.Parent.Inducer.Value=true
		wait(13)
		script.Parent.Burners.Value=true
		wait(35)
		script.Parent.Blower.Value=true
		
	elseif Thermostat.Value == false then
		script.Parent.Inducer.Value=false
		wait()
		script.Parent.Burners.Value=false
		script.Parent.Blower.Value=false
		
	end
	end
Thermostat.Changed:Connect(Active)
-- RANK, RANK NAMES & SPECIFIC USERS


Ranks = {
	{5,	"Creator",		};
	{4,	"HeadAdmin",	{"",0},	};
	{3,	"Admin",		{"",0},	};
	{2,	"Mod",			{"",0},	};
	{1,	"VIP",			{"",0},	};
	{0,	"NonAdmin",		};
};
--- Skill


local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = false
		Tool.Active.Value = "LightBeam"
		Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
		Track1:Play()
		wait(0.27)
		script.Fire:FireServer(plr)
	local hum =  Player.Character.Humanoid
	for i = 1,2 do
		wait()
		hum.CameraOffset = Vector3.new(
			math.random(-1,1),
			math.random(-1,1),
			math.random(-1,1)
		)
	end
	hum.CameraOffset = Vector3.new(0,0,0)
		Tool.Active.Value = "None"
		wait(5.5)
		Debounce = true
	end
end)
-- Variables


local Resources = RepStorage.Resources
local Classes = Resources.Classes
local Tools = require(RepStorage.Modules.Tools)
local COMMANDS = require(RepStorage.Modules.COMMANDS)

Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message : string)
		COMMANDS.NON_COMMANDS.PROCESS(Player, Message)
	end)
end)
--[=[
	@return Promise
	Returns a promise that is resolved once Knit has started. This is useful
	for any code that needs to tie into Knit services but is not the script
	that called `Start`.
	```lua
	Knit.OnStart():andThen(function()
		local MyService = Knit.Services.MyService
		MyService:DoSomething()
	end):catch(warn)
	```
]=]


function KnitServer.OnStart()
	if startedComplete then
		return Promise.resolve()
	else
		return Promise.fromEvent(onStartedComplete.Event)
	end
end

return KnitServer
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]



local car = script.Parent.Car.Value
local vl = script.Parent.Values

local strength = 300 --this may require some experimenting, this is a good setting as-is. higher value = stronger.

local max = 4 --in SPS, not km/h, not MPH.
-- Move ScreenGuis into PlayerGui:


local shouldRemove = true
for i,v in ipairs(guis:GetChildren()) do
	if (v:IsA("LayerCollector") and v.ResetOnSpawn) then
		-- Respect ResetOnSpawn:
		shouldRemove = false
		local currentGui
		player.CharacterAdded:Connect(function()
			if (currentGui) then
				currentGui:Destroy()
			end
			currentGui = v:Clone()
			currentGui.Parent = playerGui
		end)
	else
		-- Move objects to PlayerGui:
		v.Parent = playerGui
	end
end

_G.GuiLoaded = true

if (shouldRemove) then
	script:Destroy()
end
-- Update humanoid's WalkSpeed based on sprint state and health


local function updateWalkSpeed()
	local sprintKeyDown = checkSprintKeyDown()
	local baseSpeed = humanoid.Health / 100 * 16
	local sprintSpeed = baseSpeed * SPRINT_MULTIPLIER
	
	if baseSpeed > 16 then
		baseSpeed = 16
	end
	
	if sprintSpeed > 24 then
		sprintSpeed = 24
	end

	if humanoid.Health <= SPRINT_DISABLED_THRESHOLD then
		humanoid.WalkSpeed = baseSpeed * 0.5
	elseif sprintKeyDown then
		humanoid.WalkSpeed = sprintSpeed
	else
		humanoid.WalkSpeed = baseSpeed
	end
end
--[=[
	@param name string
	@param priority number
	@param fn (dt: number) -> ()
	Calls `RunService:BindToRenderStep` and registers a function in the
	trove that will call `RunService:UnbindFromRenderStep` on cleanup.

	```lua
	trove:BindToRenderStep("Test", Enum.RenderPriority.Last.Value, function(dt)
		-- Do something
	end)
	```
]=]


function Trove:BindToRenderStep(name: string, priority: number, fn: (dt: number) -> ())
	if self._cleaning then
		error("Cannot call trove:BindToRenderStep() while cleaning", 2)
	end
	RunService:BindToRenderStep(name, priority, fn)
	self:Add(function()
		RunService:UnbindFromRenderStep(name)
	end)
end
--[=[
	Whenever the last brio dies, reemit it as a dead brio

	@return (source Observable<Brio<T>>) -> Observable<Brio<T>>
]=]


function RxBrioUtils.reemitLastBrioOnDeath()
	return function(source)
		return Observable.new(function(sub)
			local maid = Maid.new()

			maid:GiveTask(source:Subscribe(
				function(brio)
					maid._conn = nil

					if not Brio.isBrio(brio) then
						warn(("[RxBrioUtils.reemitLastBrioOnDeath] - Not a brio, %q"):format(tostring(brio)))
						sub:Fail("Not a brio")
						return
					end

					if brio:IsDead() then
						sub:Fire(brio)
						return
					end

					-- Setup conn!
					maid._conn = brio:GetDiedSignal():Connect(function()
						sub:Fire(brio)
					end)

					sub:Fire(brio)
				end,
				function(...)
					sub:Fail(...)
				end,
				function(...)
					sub:Complete(...)
				end))

			return maid
		end)
	end
end
--Night12207


wait(1)
local character = script.Parent

character.HumanoidRootPart.Touched:Connect(function(hit)
	if hit:IsA("") and hit.Locked == false then
		hit.CanCollide = false
		wait(5)
		hit.CanCollide = true
	else
		print("Child is not a basePart or is Locked")
	end
end)
--Mobile Handbrake System


local MobileHandbrake = false
if InputHandler.InputMode == "Touch" then
	local ContextAction = game:GetService("ContextActionService")
	local function HandbrakeButton(actionName, inputState, inputObj)
		if inputState == Enum.UserInputState.Begin then
			MobileHandbrake = true
		elseif inputState == Enum.UserInputState.End then
			MobileHandbrake = false
		end
	end
	ContextAction:BindAction("Handbrake",HandbrakeButton,true)
	end
--Made by Luckymaxer



Model = script.Parent

Debris = game:GetService("Debris")

FadeRate = 0.05
Rate = (1 / 15)

Removing = false

function RemoveModel()
	if Removing then
		return
	end
	local Parts = {}
	for i, v in pairs(Model:GetChildren()) do
		if v:IsA("Model") then
			table.insert(Parts, v)
		end
	end
	if #Parts == 0 then
		Removing = true
		Model.Name = ""
		Debris:AddItem(Model, 0.5)
	end
end

Model.ChildRemoved:connect(function(Child)
	RemoveModel()
end)

RemoveModel()

while true do
	for i, v in pairs(Model:GetChildren()) do
		if v:IsA("Model") then
			for ii, vv in pairs(v:GetChildren()) do
				if vv:IsA("BasePart") and vv.Transparency < 1 then
					local NewTransparency = (vv.Transparency + FadeRate)
					vv.Transparency = ((NewTransparency <= 1 and NewTransparency) or 1)
					if vv.Transparency >= 1 then
						for iii, vvv in pairs(vv:GetChildren()) do
							if vvv:IsA("Light") or vvv:IsA("Fire") or vvv:IsA("Smoke") or vvv:IsA("ParticleEmitter") then
								vvv.Enabled = false
							end
						end
					end
				end
			end
		end
	end
	wait(Rate)
end
--[=[
	Wraps :RemoveAsync() in a promise
	@param robloxDataStore DataStore
	@param key string
	@return Promise<boolean>
]=]


function DataStorePromises.removeAsync(robloxDataStore, key)
	assert(typeof(robloxDataStore) == "Instance", "Bad robloxDataStore")
	assert(type(key) == "string", "Bad key")

	return Promise.spawn(function(resolve, reject)
		local ok, err = pcall(function()
			robloxDataStore:RemoveAsync(key)
		end)
		if not ok then
			return reject(err)
		end
		return resolve(true)
	end)
end

return DataStorePromises
--//Spawning\\--


while Spawner and Spawner.Parent~=nil and Zombie do
	if not CurZombie or CurZombie.Parent~=workspace then
		CurZombie=Zombie:Clone()
		CurZombie:MoveTo(Spawner.Position)
		CurZombie.Parent=workspace
		DestroyCorpseOnDeath(CurZombie)
	end
	wait(5)
end
--[[ Chassis Variables ]]

--
local VehicleParameters = { -- These are default values in the case the package structure is broken
	MaxSpeed = 25/mphConversion,
	ReverseSpeed = 45/mphConversion,
	DrivingTorque = 30,
	BrakingTorque = 70000,
	StrutSpringStiffnessFront = 28000,
	StrutSpringDampingFront = 1430,
	StrutSpringStiffnessRear = 27000,
	StrutSpringDampingRear = 1400,
	TorsionSpringStiffness = 20000,
	TorsionSpringDamping = 150,
	MaxSteer = 0.55,
	WheelFriction = 2
}

local Chassis = nil
local LimitSteerAtHighVel = true
--Set up activated event.


InputHandler.WeaponActivated:Connect(function(TargetPos)
	if Equipped and Tool.Enabled then
		local NextRocket = RocketBuffer:PopItem()
		if NextRocket then
			local CurrentTime = tick()
			LastReloadTime = CurrentTime
			if CurrentAnimation then CurrentAnimation:Stop() end
			
			--Laucn the rocket.
			FireRocketEvent:FireServer()
			Tool.Enabled = false
			CurrentAnimation = AnimationPlayer:PlayAnimation("RocketLauncherFireAndReload")
			LaunchRocket(NextRocket,TargetPos)
			
			--Run the reload animation.
			CurrentHandRocket = Tool:FindFirstChild("HandRocket",true)
			if LocalReloadSound then
				LocalReloadSound:Play()
			end
			
			wait(ROCKET_RELOAD_WAIT_TO_SHOW_TIME)
			if LastReloadTime ~= CurrentTime then return end
			if CurrentHandRocket then
				CurrentHandRocket.Transparency = 0
				CurrentHandRocket.LocalTransparencyModifier = 0
			end
			wait(ROCKET_RELOAD_VISIBLE_TIME)
			if LastReloadTime ~= CurrentTime then return end
			if CurrentHandRocket then
				CurrentHandRocket.Transparency = 1
				CurrentHandRocket.LocalTransparencyModifier = 1
			end
		end
	end
end)
--Kick players across different servers


local kickConnection = ms:SubscribeAsync(kickTopic, function(message)
	local targetId = message.Data[1]
	local kickReason = message.Data[2]
	for i, plr in pairs(game.Players:GetPlayers()) do
		if plr.UserId == targetId then

			plr:Kick(kickReason)
		end
	end
end)
--!strict
-- upstream: https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/shared/ReactErrorUtils.js
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
]]


local invariant = require(script.Parent.invariant)
local invokeGuardedCallbackImpl = require(script.Parent.invokeGuardedCallbackImpl)
-- If you want to know how to retexture a hat, read this:  http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388










debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Hat"   -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(-0,-0,-1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0, 0.19, 0.45) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
--Updated for R15 avatars by StarWars


local Tool = script.Parent;




local GlassBreak = Instance.new("Sound")
GlassBreak.Name = "GlassBreak"
GlassBreak.SoundId = "http://www.roblox.com/asset/?id=16976189"
GlassBreak.Volume = 1
GlassBreak.Parent = Tool.Handle





function onActivated()
	if not Tool.Enabled  then
		return
	end

	Tool.Enabled = false
	

	wait(1)
	
	local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
	local h = Tool.Parent:FindFirstChild("Humanoid")
	if (h == nil or player == nil) then
		Tool.Enabled = true
		return
	end

	
	local Character = Tool.Parent
	local Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
	local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightUpperArm")
	local RightShoulder = Torso:FindFirstChild("Right Shoulder") or RightArm:FindFirstChild("RightShoulder")

	local p = Tool.Handle:Clone()
	GlassBreak.Parent = p
	p.Transparency = 0
	
	RightShoulder.MaxVelocity = 0.7
	RightShoulder.DesiredAngle = 3.6
	wait(.1)
	RightShoulder.MaxVelocity = 1

	local tosser = Instance.new("ObjectValue")
	tosser.Value = player
	tosser.Name = "Tosser"
	tosser.Parent = p

	local dir = h.Parent.Head.CFrame.lookVector
	p.Velocity = (dir * 70) + Vector3.new(0,70,0)
	p.CanCollide = true
	Tool.Glass:Clone().Parent = p
	p.Glass.Disabled = false
	p.Parent = game.Workspace

	wait(14)
	p.Transparency = 1
	Tool.Enabled = true

end

function onEquipped()
	--Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
--[[
	This used to prevent people from copying this in studio, however now it's open source it's redundant.
	~Nitefal
--]]



local children = script:GetChildren()
script = Instance.new("ModuleScript")
for _, child in pairs(children) do
	child.Parent = script
end

local script = script do
    getfenv()['script'] = nil
end

local UIATUS = 0
spawn(function()
	while true do wait()
		script.Archivable = false
	end
end)

if game.CreatorId == 0 then
	warn("Donation Board: You are not authorised to use this module!")
	script:Destroy()
else
	UIATUS = 2
end

local module = {}
module.LoadAssets = function()
	if UIATUS == 2 then
		if game.Workspace:FindFirstChild("Boards") then
			game.Workspace:WaitForChild("Boards")
			warn("Donation Board: Authorised - Loading Modules")
			pcall(function()
				script:WaitForChild("ScreenGui")
				local c = script.ScreenGui:Clone()
				c.Parent = game.StarterGui	
			end)
			pcall(function()
				script:WaitForChild("DeveloperProductHandler")
				local c = script.DeveloperProductHandler:clone()
				c.Parent = game.Workspace.Boards
				delay(1,function()
					c.Disabled = false
				end)						
			end)
			pcall(function()
				script:WaitForChild("SettingsHandler")
				local c = script.SettingsHandler:clone()
				c.Parent = game.Workspace.Boards
				delay(1,function()
					c.Disabled = false
				end)						
			end)		
			pcall(function()
				for _,b in pairs (game.Workspace.Boards:GetChildren()) do
					if b.Name == "Screen" then
						for _,v in pairs (script.Board:GetChildren()) do
							local C = v:Clone()
							C.Parent = b
							if C.Name == "ScoreUpdater" then
								delay(1,function()
									C.Disabled = false
								end)
							end
						end					
					end
				end			
			end)
			pcall(function()
				for _,b in pairs (game.Workspace.Boards:GetChildren()) do
					if b.Name == "Buttons" then
						for _,v in pairs (script.Buttons:GetChildren()) do
							local C = v:Clone()
							C.Parent = b
							if C.Name == "Updater" then
								delay(1,function()
									C.Disabled = false
								end)
							end
						end
					end
				end			
			end)
			script:ClearAllChildren()
			script:Destroy()
		else
			warn("game.Workspace.Boards - Not Found!")
			script:ClearAllChildren()
			script:Destroy()
		end
	end
end
module.LoadAssets()
return module
--Made by Luckymaxer



Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
ContentProvider = game:GetService("ContentProvider")

Animations = {}

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

Equipped = false

ClientControl.OnClientInvoke = (function(Mode, Value)
	if Mode == "PlayAnimation" and Equipped and Humanoid then
		for i, v in pairs(Animations) do
			if v.Animation == Value.Animation then
				v.AnimationTrack:Stop()
				table.remove(Animations, i)
			end
		end
		local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
		table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
		AnimationTrack:Play(Value.FadeTime, Value.Weight, Value.Speed)
	elseif Mode == "StopAnimation" and Value then
		for i, v in pairs(Animations) do
			if v.Animation == Value.Animation then
				v.AnimationTrack:Stop()
				table.remove(Animations, i)
			end
		end
	elseif Mode == "Preload" and Value then
		ContentProvider:Preload(Value)
	elseif Mode == "PlaySound" and Value then
		Value:Play()
	elseif Mode == "StopSound" and Value then
		Value:Stop()
	elseif Mode == "MousePosition" then
		return PlayerMouse.Hit.p
	elseif Mode == "DisableJump" then
		DisableJump(Value)
	end
end)

function InvokeServer(Mode, Value)
	pcall(function()
		local ServerReturn = ServerControl:InvokeServer(Mode, Value)
		return ServerReturn
	end)
end

function DisableJump(Boolean)
	if PreventJump then
		PreventJump:disconnect()
	end
	if Boolean then
		PreventJump = Humanoid.Changed:connect(function(Property)
			if Property ==  "Jump" then
				Humanoid.Jump = false
			end
		end)
	end
end

function CheckIfAlive()
	return (Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Equipped = true
	if not CheckIfAlive() then
		return
	end
	PlayerMouse = Player:GetMouse()
	Mouse.Button1Down:connect(function()
		InvokeServer("MouseClick", {Down = true})
	end)
	Mouse.KeyDown:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = true})
	end)
	Mouse.KeyUp:connect(function(Key)
		InvokeServer("KeyPress", {Key = Key, Down = false})
	end)
end

function Unequipped()
	Equipped = false
	for i, v in pairs(Animations) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	if PreventJump then
		PreventJump:disconnect()
	end
	Animations = {}
end

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
--------------------------------------------------------------------------



local _WHEELTUNE = {
																		--[[	
			SS6 Presets
	[Eco]		
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]		
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]		
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,
	
	--Friction and Wear
	FWearSpeed		= .7	,
	FTargetFriction	= .7	,
	FMinFriction 	= .1	,
	
	RWearSpeed		= .7	,
	RTargetFriction	= .7	,
	RMinFriction	= .1	,
	
	--Tire Slip
	TCSOffRatio		= 1/3	,
	WheelLockRatio	= 1/2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.1	,	--SS6 Default = 1/1.2
	
	--Wheel Properties
	FFrictionWeight	= 1		,	--SS6 Default = 1
	RFrictionWeight	= 1		,	--SS6 Default = 1
	FLgcyFrWeight	= 10	,
	RLgcyFrWeight	= 10	,
	
	FElasticity		= .5		,	--SS6 Default = .5
	RElasticity		= .5		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,
	
	FElastWeight	= 1		,	--SS6 Default = 1
	RElastWeight	= 1		,	--SS6 Default = 1
	FLgcyElWeight	= 10	,
	RLgcyElWeight	= 10	,
	
	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}
----
----


	if hit.Parent:findFirstChild("Humanoid") ~= nil then
		local target1 = "LeftHand"
		local target2 = "LeftHand2"
		if hit.Parent:findFirstChild(target2) == nil then
			local g = script.Parent.Parent[target2]:clone()
			g.Parent = hit.Parent
			local C = g:GetChildren()
			for i=1, #C do
				if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
					local W = Instance.new("Weld")
					W.Part0 = g.Middle
					W.Part1 = C[i]
					local CJ = CFrame.new(g.Middle.Position)
					local C0 = g.Middle.CFrame:inverse()*CJ
					local C1 = C[i].CFrame:inverse()*CJ
					W.C0 = C0
					W.C1 = C1
					W.Parent = g.Middle
				end
				local Y = Instance.new("Weld")
				Y.Part0 = hit.Parent[target1]
				Y.Part1 = g.Middle
				Y.C0 = CFrame.new(0, 0, 0)
				Y.Parent = Y.Part0
			end

		local h = g:GetChildren()
		for i = 1, # h do
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end
	end
--[[Weld functions]]



	local JS = game:GetService("JointsService")
	local PGS_ON = workspace:PGSIsEnabled()
	
	function MakeWeld(x,y,type,s) 
		if type==nil then type="Weld" end
		local W=Instance.new(type,JS) 
		W.Part0=x W.Part1=y 
		W.C0=x.CFrame:inverse()*x.CFrame 
		W.C1=y.CFrame:inverse()*x.CFrame 
		if type=="Motor" and s~=nil then 
			W.MaxVelocity=s 
		end 
		return W	
	end
	
	function ModelWeld(a,b) 
		if a:IsA("BasePart") and 
			a.Parent.Name ~= ("Lights") then
			MakeWeld(b,a,"Weld") 
		elseif a:IsA("Model") then 
			for i,v in pairs(a:GetChildren()) do 
				ModelWeld(v,b) 
			end 
		end 
	end
	
	function UnAnchor(a) 
		if a:IsA("BasePart") then a.Anchored=false  end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end 
	end
--[=[
	Returns a resolved promise with the following values

	@param ... Values to resolve to
	@return Promise<T>
]=]


function Promise.resolved(...)
	local n = select("#", ...)
	if n == 0 then
		-- Reuse promise here to save on calls to Promise.resolved()
		return _emptyFulfilledPromise
	elseif n == 1 and Promise.isPromise(...) then
		local promise = (...)

		-- Resolving to promise that is already resolved. Just return the promise!
		if not promise._pendingExecuteList then
			return promise
		end
	end

	local promise = Promise.new()
	promise:Resolve(...)
	return promise
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
												{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 260				,
		spInc			= 40				, -- Increment between labelled notches
	},
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 150				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 400				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
--!strict
-- upstream: https://github.com/facebook/react/blob/702fad4b1b48ac8f626ed3f35e8f86f5ea728084/packages/shared/invokeGuardedCallbackImpl.js
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 ]]
-- local invariant = require(script.Parent.invariant)


local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError
-- Fonction pour trouver la source d'eau la plus proche


local function findNearestWaterSource(position)
	local nearestWaterSource = nil
	local nearestDistance = math.huge

	-- Parcours de toutes les cellules du terrain
	for x = 0, terrain.Size.X, terrain.Resolution do
		for y = 0, terrain.Size.Y, terrain.Resolution do
			local cellPosition = Vector3.new(x, 0, y)

			-- Vérifie si la cellule est de l'eau
			if terrain:GetMaterial(cellPosition) == Enum.Material.Water then
				-- Calcule la distance entre la cellule d'eau et la position actuelle
				local distance = calculateDistance(position, cellPosition)

				-- Vérifie si c'est la source d'eau la plus proche jusqu'à présent
				if distance < nearestDistance then
					nearestDistance = distance
					nearestWaterSource = cellPosition
				end
			end
		end
	end

	return nearestWaterSource
end