Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[=[
	Constructs a new DataStoreStage to load from. Prefer to use DataStore because this doesn't
	have any way to retrieve this.
	@param loadName string
	@param loadParent DataStoreStage?
	@return DataStoreStage
]=]


function DataStoreStage.new(loadName, loadParent)
	local self = setmetatable(BaseObject.new(), DataStoreStage)

	-- LoadParent is optional, used for loading
	self._loadName = loadName
	self._loadParent = loadParent

	self._savingCallbacks = {} -- [func, ...]
	self._takenKeys = {} -- [name] = true
	self._stores = {} -- [name] = dataSubStore

	return self
end
-- dragger



local slideDrag = dragger.new(slide,slider);
local ringDrag = dragger.new(ring,wheel);

function slideDrag:onDrag(guiElement, input, delta)
	local rY = input.Position.y - slider.AbsolutePosition.y;
	local cY = math.clamp(rY, 0, slider.AbsoluteSize.y - slide.AbsoluteSize.y);
	guiElement.Position = UDim2.new(0, 0, 0, cY);
	
	value = 1 - (cY / (slider.AbsoluteSize.y - slide.AbsoluteSize.y));
	guiElement.BackgroundColor3 = Color3.fromHSV(0, 0, 1-value);
	
	update();
end

function ringDrag:onDrag(guiElement, input, delta)
	local r = wheel.AbsoluteSize.x/2
	local d = Vector2.new(input.Position.x, input.Position.y) - wheel.AbsolutePosition - wheel.AbsoluteSize/2;

	if (d:Dot(d) > r*r) then
		d = d.unit * r;
	end
	
	guiElement.Position = UDim2.new(0.5, d.x, 0.5, d.y);
	
	local phi, len = toPolar(d * Vector2.new(1, -1));
	hue, saturation = radToDeg(phi)/360, len / r;
	slider.BackgroundColor3 = Color3.fromHSV(hue, saturation, 1);
	
	update();
end
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/test-utils/src/index.ts
-- /**
--  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
--  *
--  * This source code is licensed under the MIT license found in the
--  * LICENSE file in the root directory of this source tree.
--  */



local CurrentModule = script

local alignedAnsiStyleSerializer = require(CurrentModule.alignedAnsiStyleSerializer)
local configModule = require(CurrentModule.config)
----- NO EDITING BELOW -----


local weldedParts = {}
table.insert(weldedParts,mainPart)

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

function WeldRec(instance)
	local childs = instance:GetChildren()
	for _,v in pairs(childs) do
		if v:IsA("MeshPart") then
			Weld(mainPart, v)
		end
		WeldRec(v)
	end	
end

WeldRec(P)
--------------------------------------------------


script.Parent.Values.RPM.Changed:connect(function()
	intach.Rotation = -80 + script.Parent.Values.RPM.Value * 240 / 12000
end)

script.Parent.Values.Velocity.Changed:connect(function(property)
	inspd.Rotation = -30 + (440 / 300) * (math.abs(script.Parent.Values.Velocity.Value.Magnitude*((6/12) * (50/58))))
end)

if _Tune.Aspiration ~= "Natural" then 
	if _Tune.Aspiration == "Single" then 
		_TCount = 1 
	elseif _Tune.Aspiration == "Double" then 
		_TCount = 2 
	end
	script.Parent.Values.Boost.Changed:connect(function()
		local boost = (math.floor(script.Parent.Values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
		inbst.Rotation = -30 + 61 * math.min(1,(script.Parent.Values.Boost.Value/(_Tune.Boost)/_TCount))
	end)
end
--[[Drivetrain]]

	
	Tune.Config			= "RWD"		--"FWD" , "RWD" , "AWD"
	
	--Differential Settings	
	Tune.FDiffSlipThres	= 50		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 50		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 50		-- 1 - 100%
	Tune.RDiffLockThres	= 50		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
	
	--Traction Control Settings
	Tune.TCSEnabled		= false		-- Implements TCS
	Tune.TCSThreshold	= 20		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 20		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 10		-- Minimum amount of torque at max reduction (in percent)
--[=[
	Constructs a new JSONTranslator from the given args.

	```lua
	local translator = JSONTranslator.new("en", {
		actions = {
			respawn = "Respawn {playerName}";
		};
	})

	print(translator:FormatByKey("actions.respawn"), { playerName = "Quenty"}) --> Respawn Quenty
	```

	```lua
	local translator = JSONTranslator.new(script)
	-- assume there is an `en.json` underneath the script with valid JSON.
	```

	@param ... any
	@return JSONTranslator
]=]


function JSONTranslator.new(...)
	local self = setmetatable({}, JSONTranslator)

	-- Cache localizaiton table, because it can take 10-20ms to load.
	self._localizationTable = JsonToLocalizationTable.toLocalizationTable(...)
	self._englishTranslator = self._localizationTable:GetTranslator("en")
	self._fallbacks = {}

	if RunService:IsRunning() then
		self._promiseTranslator = LocalizationServiceUtils.promiseTranslator(Players.LocalPlayer)
	else
		self._promiseTranslator = Promise.resolved(self._englishTranslator)
	end

	if RunService:IsStudio() then
		PseudoLocalize.addToLocalizationTable(self._localizationTable, nil, "en")
	end

	return self
end

function JSONTranslator:GetLocalizationTable()
	return self._localizationTable
end
-- thanks for using my model, please put in in startercharacterscripts.
-- this camera bob includes a slight bob when you're standing still and an actual bob when u move. just like the horror games.
-- i hope u like it :D



local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera

local player = game.Players.LocalPlayer
player.CameraMode = Enum.CameraMode.LockFirstPerson

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
----------------------------------------------------------------------- 


	EngineModule.Stop = function()
		engine.Flying:Stop()
		engine.StartUp:Stop()
		for _,e in pairs(Misc:GetChildren()) do
			if e.Name == "Vents" then
				e.Smoke.Enabled = false
			end
		end
		for _,i in pairs(Misc:GetChildren()) do
			if i.Name == "Rotor" and i:FindFirstChild("Motor") ~= nil then
				repeat wait(0.001)
					i.Motor.MaxVelocity = i.Motor.MaxVelocity - 0.01
				until i.Motor.MaxVelocity <= 0
				i.Motor.MaxVelocity = 0
			end
		end	
	end
--use this to determine if you want this human to be harmed or not, returns boolean


function checkTeams(otherHuman)
	return not (sameTeam(otherHuman) and not FriendlyFire)
end

function getKnife()
	local knife = Handle:clone()
	knife.Transparency = 0
	knife.Hit.Pitch = math.random(90, 110)/100
	
	local lift = Instance.new("BodyForce")
	lift.force = Vector3.new(0, 196.2, 0) * knife:GetMass() * 0.8
	lift.Parent = knife
	
	local proj = Tool.Projectile:Clone()
	proj.Disabled = false
	proj.Parent = knife
	
	return knife
end

function equippedLoop()
	while Equipped do
		local dt = Heartbeat:wait()
		
		if AttackPower < 1 then
			AttackPower = AttackPower + dt * AttackRecharge
			if AttackPower > 1 then
				AttackPower = 1
			end
		end
		
		Handle.Fire.Enabled = AttackPower >= 1
		Handle.Transparency = 1 - AttackPower
	end
end

function onLeftDown(mousePos)
	local knife = getKnife()
	knife.CFrame = CFrame.new(Handle.Position, mousePos)
	knife.Velocity = knife.CFrame.lookVector * AttackSpeed * AttackPower
	local damage = AttackDamage * AttackPower
	local touched
	touched = knife.Touched:connect(function(part)
		if part:IsDescendantOf(Tool.Parent) then return end
		if contains(Knives, part) then return end
		
		if part.Parent and part.Parent:FindFirstChild("Humanoid") then
			local human = part.Parent.Humanoid
			if checkTeams(human) then
				tagHuman(human)
				human:TakeDamage(damage)
				knife.Hit:Play()
			end
		end
		
		knife.Projectile:Destroy()
		
		local w = Instance.new("Weld")
		w.Part0 = part
		w.Part1 = knife
		w.C0 = part.CFrame:toObjectSpace(knife.CFrame)
		w.Parent = w.Part0
		
		touched:disconnect()
	end)
	table.insert(Knives, knife)
	knife.Parent = workspace
	
	game:GetService("Debris"):AddItem(knife, 3.5)
	delay(2, function()
		knife.Transparency = 1
		knife.Fire.Enabled = false
	end)
	
	Remote:FireClient(getPlayer(), "PlayAnimation", "Throw")	
	
	Handle.Throw.Pitch = 0.8 + 0.4 * AttackPower
	Handle.Throw:Play()
	
	AttackPower = 0
end

function onRemote(player, func, ...)
	if player ~= getPlayer() then return end
	
	if func == "LeftDown" then
		onLeftDown(...)
	end
end

function onEquip()
	Equipped = true
	equippedLoop()
end

function onUnequip()
	Equipped = false
end

Remote.OnServerEvent:connect(onRemote)
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local MoneyModule = require(game.ReplicatedStorage.Source.SystemModules.Money)
	if MoneyModule.HasEnough(player,dialogueFolder.Parent) then
		return true
	end
	return false
end
--[[ SCRIPT VARIABLES ]]


local CHAT_BUBBLE_FONT = Enum.Font.ArialBold
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_PADDING = 12
local CHAT_BUBBLE_FADE_SPEED = 1.5

local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250	--This limits the number of bubble chats that you see above characters

local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - getMessageLength(ELIPSES) - 1

local NEAR_BUBBLE_DISTANCE = 65	--previously 45
local MAX_BUBBLE_DISTANCE = 100	--previously 80
-- So in the example above, the door will move thirty times, with a distance of 0.1 every 0.01 seconds.
-- Feel free to mess around with values to try and get the door moving as smoothly as possible.
-- Remember, if the door is say 3 studs wide, you will have to move it 3 studs, like in the example above 0.1 x 30 = 3


	
		wait(1) -- How long the door will remain open

		for i=1, 30 do
				p.CFrame = p.CFrame + Vector3.new(-0.1, 0, 0)
				wait(.01) 
				end
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
		if key == "u" then --Window controls
		 if windows == false then 
			winfob.Visible = true
			windows = true
		 else windows = false
			winfob.Visible = false
		 end
		elseif key == "[" then -- volume down
			if carSeat.Parent.Body.MP.Sound.Volume > 0 then
				handler:FireServer('updateVolume', -0.2)
			end
		elseif key == "]" then -- volume up
			if carSeat.Parent.Body.MP.Sound.Volume < 10 then
				handler:FireServer('updateVolume', 0.2)
			end	
	end
end)

winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
	handler:FireServer('updateSong', winfob.mg.Input.Text)
end)
-- Do not touch unless you know what you're doing.


local TweenService = game:GetService("TweenService")
local camera = workspace.Camera

function tween(part1, part2, cutsceneTime)
	local tweeninfo = TweenInfo.new(
		cutsceneTime,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweeninfo, {CFrame = part2.CFrame})
	tween:Play()
	
	wait(cutsceneTime)
	
	camera.CameraType = Enum.CameraType.Custom
end

game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function()
	game.Workspace.Test1.Locked = true
	tween(game.Workspace.Test1, game.Workspace.Test2, 1)
	tween(game.Workspace.Test2, game.Workspace.Test3, 10)
end)
--Made by Luckymaxer



Debris = game:GetService("Debris")

ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Ray", "Bullet", "ParticlePart"}

Functions = {
	
	CreateConfiguration = (function(Configurations, Table)
		for i, v in pairs(Configurations:GetChildren()) do
			if string.find(v.ClassName, "Value") then
				Table[v.Name] = v:Clone()
			elseif v:IsA("Folder") or v:IsA("Configuration") then
				Table[v.Name] = Functions.CreateConfiguration(v, Table)
			end
		end
		return Table
	end),
	
	FindCharacterAncestor = (function(Object)
		if Object and Object ~= game:GetService("Workspace") then
			local Humanoid = Object:FindFirstChild("Humanoid")
			if Humanoid then
				return Object, Humanoid
			else
				return Functions.FindCharacterAncestor(Object.Parent)
			end
		end
		return nil
	end),

	CheckTableForString = (function(Table, String)
		for i, v in pairs(Table) do
			if string.lower(v) == string.lower(String) then
				return true
			end
		end
		return false
	end),
	
	CheckIntangible = (function(Hit)
		if Hit and Hit.Parent then
			if Functions.CheckTableForString(ProjectileNames, Hit.Name) then
				return true
			end
			local ObjectParent = Hit.Parent
			local Character = ObjectParent.Parent
			local Humanoid = Character:FindFirstChild("Humanoid")
			if Humanoid and Humanoid.Health > 0 and ObjectParent:IsA("Hat") then
				return true
			end
		end
		return false
	end),
	
	CastRay = (function(StartPos, Vec, Length, Ignore, DelayIfHit)
		local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
		if RayHit and Functions.CheckIntangible(RayHit) then
			if DelayIfHit then
				wait()
			end
			RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
		end
		return RayHit, RayPos, RayNormal
	end),
	
	IsTeamMate = (function(Player1, Player2)
		return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
	end),
	
	TagHumanoid = (function(humanoid, player)
		local Creator_Tag = Instance.new("ObjectValue")
		Creator_Tag.Name = "creator"
		Creator_Tag.Value = player
		Debris:AddItem(Creator_Tag, 2)
		Creator_Tag.Parent = humanoid
	end),
	
	UntagHumanoid = (function(humanoid)
		for i, v in pairs(humanoid:GetChildren()) do
			if v:IsA("ObjectValue") and v.Name == "creator" then
				v:Destroy()
			end
		end
	end),
	
	CheckTableForString = (function(Table, String)
		for i, v in pairs(Table) do
			if string.lower(v) == string.lower(String) then
				return true
			end
		end
		return false
	end),
	
	Clamp = (function(Number, Min, Max)
		return math.max(math.min(Max, Number), Min)
	end),
	
	GetPercentage = (function(Start, End, Number)
		return (((Number - Start) / (End - Start)) * 100)
	end),
	
	Round = (function(Number, RoundDecimal)
		local WholeNumber, Decimal = math.modf(Number)
		return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
	end),
	
}

return Functions
--[=[
	@tag Component Class
	`Stop` is called when the component is stopped. This occurs either when the
	bound instance is removed from one of the whitelisted ancestors _or_ when
	the matching tag is removed from the instance. This also means that the
	instance _might_ be destroyed, and thus it is not safe to continue using
	the bound instance (e.g. `self.Instance`) any longer.

	This should be used to clean up the component.

	```lua
	local MyComponent = Component.new({Tag = "MyComponent"})

	function MyComponent:Stop()
		self.SomeStuff:Destroy()
	end
	```
]=]


function Component:Stop()
end
-- put in: StarterPlayer > StarterCharacterScript



local char = script.Parent

local human = char:FindFirstChildOfClass("Humanoid") or char:WaitForChild("Humanoid")
local cam = workspace.CurrentCamera
local humspeed = 0

if not human then
	return
end

human.Running:Connect(function(sp)
	humspeed = sp
end)

game:GetService("RunService").RenderStepped:Connect(function()
	local ticked = tick()
	if human.MoveDirection.Magnitude > 0 then
		cam.CFrame = cam.CFrame:Lerp(cam.CFrame * CFrame.Angles(math.rad(math.sin(ticked * humspeed) * 1), math.rad(math.sin(ticked * humspeed)), math.rad(math.sin(ticked * humspeed) * 2)), humspeed / 100)
	else
		cam.CFrame = cam.CFrame:Lerp(cam.CFrame * CFrame.Angles(math.rad(math.sin(ticked * 1) * 0.90), 0, 0), 0.0)
	end
end)
--[[
	Takes a list of callbacks, and runs them as separate coroutines, yielding the current thread until all the coroutines are dead.

	This function yields until either all callbacks have returned, or a callback has errored. Returns success, result.

	Exposes similar functionality to Promise.All in JS, or WaitGroups in Go.
--]]



local function checkIfOtherThreadsAreDead(threads: { thread })
	for _, thread in ipairs(threads) do
		if thread ~= coroutine.running() then
			if coroutine.status(thread) ~= "dead" then
				return false
			end
		end
	end

	return true
end

type Callback = (...any) -> ...any

local function waitAllAsync(callbacks: { Callback }): (boolean, ...any)
	local baseThread = coroutine.running()
	local threads: { thread } = {}
	local hasErrored = false

	for _, callback in ipairs(callbacks) do
		local thisThread = coroutine.create(function()
			local success, result = pcall(callback)

			if success and not hasErrored then
				-- If this callback has completed, all other threads are dead, and we haven't already resumed on an error then we are good to proceed!
				if checkIfOtherThreadsAreDead(threads) then
					task.spawn(baseThread, true)
				end
			elseif not hasErrored then
				hasErrored = true

				task.spawn(baseThread, false, result)
			end
		end)

		table.insert(threads, thisThread)

		-- Use task.defer so this callback can't return before the baseThread has yielded
		task.defer(thisThread)
	end

	if #threads > 0 then
		-- We yield the main thread here so it can be resumed once the callbacks have completed
		return coroutine.yield(baseThread)
	else
		return true
	end
end

return waitAllAsync
--		print("Keyframe : ".. FrameName)


		local RepeatAnim = StopToolAnimations()
		PlayToolAnimation(RepeatAnim, 0, Humanoid)
	end
end


function PlayToolAnimation(AnimName, TransitionTime, Humanoid)
	if AnimName ~= ToolAnimName then
		
		if ToolAnimTrack then
			ToolAnimTrack:Stop()
			ToolAnimTrack:Destroy()
			TransitionTime = 0
		end

		local Roll = math.random(1, AnimTable[AnimName].TotalWeight) 
		local OrigRoll = Roll
		local Index = 1
		while Roll > AnimTable[AnimName][Index].Weight do
			Roll = Roll - AnimTable[AnimName][Index].Weight
			Index = Index + 1
		end
--[=[
	@return SIGNAL_MARKER
	Returns a marker that will transform the current key into
	a RemoteSignal once the service is created. Should only
	be called within the Client table of a service.

	See [RemoteSignal](https://sleitnick.github.io/RbxUtil/api/RemoteSignal)
	documentation for more info.
	```lua
	local MyService = Knit.CreateService {
		Name = "MyService";
		Client = {
			-- Create the signal marker, which will turn into a
			-- RemoteSignal when Knit.Start() is called:
			MySignal = Knit.CreateSignal()
		}
	}

	function MyService:KnitInit()
		-- Connect to the signal:
		self.Client.MySignal:Connect(function(player, ...) end)
	end
	```
]=]


function KnitServer.CreateSignal()
	return SIGNAL_MARKER
end
-- From TransparencyController


function CameraUtils.Round(num, places)
	local decimalPivot = 10^places
	return math.floor(num * decimalPivot + 0.5) / decimalPivot
end

function CameraUtils.IsFinite(val)
	return val == val and val ~= math.huge and val ~= -math.huge
end

function CameraUtils.IsFiniteVector3(vec3)
	return CameraUtils.IsFinite(vec3.X) and CameraUtils.IsFinite(vec3.Y) and CameraUtils.IsFinite(vec3.Z)
end
--Model Creation--



local susp = Instance.new("Model")
susp.Name = "Suspension"
susp.Parent = script.Parent.Parent.Parent

local suspRL = Instance.new("Model")
suspRL.Name = "RL"
suspRL.Parent = susp

local suspRR = Instance.new("Model")
suspRR.Name = "RR"
suspRR.Parent = susp

local LWm = Instance.new("Model")
LWm.Name = "LW"
LWm.Parent = script.Parent.Parent.Parent

local RWm = Instance.new("Model")
RWm.Name = "RW"
RWm.Parent = script.Parent.Parent.Parent

local WheelGroup = Instance.new("Model")
WheelGroup.Name = "Wheels"
WheelGroup.Parent = script.Parent.Parent.Parent
--[=[
	Takes n entries and then completes the observation.

	https://rxjs.dev/api/operators/take
	@param toSkip number
	@return (source: Observable<T>) -> Observable<T>
]=]


function Rx.skip(toSkip)
	assert(type(toSkip) == "number", "Bad toSkip")
	assert(toSkip > 0, "Bad toSkip")

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			local skipped = 0
			local maid = Maid.new()

			maid:GiveTask(source:Subscribe(function(...)
				if skipped <= toSkip then
					skipped = skipped + 1
					return
				end

				sub:Fire(...)
			end, sub:GetFailComplete()))

			return maid
		end)
	end
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!


local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.WoodenSword -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
-- Bindable for when we want touch emergency controls
-- TODO: Click to move should probably have it's own gui touch controls
-- to manage this.


local BindableEvent_OnFailStateChanged = nil
local BindableEvent_EnableTouchJump = nil
if UIS.TouchEnabled then
	BindableEvent_OnFailStateChanged = Instance.new('BindableEvent')
	BindableEvent_OnFailStateChanged.Name = "OnClickToMoveFailStateChange"
	BindableEvent_EnableTouchJump = Instance.new('BindableEvent')
	BindableEvent_EnableTouchJump.Name = "EnableTouchJump"
	local CameraScript = script.Parent
	local PlayerScripts = CameraScript.Parent
	BindableEvent_OnFailStateChanged.Parent = PlayerScripts
	BindableEvent_EnableTouchJump.Parent = PlayerScripts
end

local function clamp(low, high, num)
	return (num > high and high or num < low and low or num)
end
----------------------------------------------------##


script.Parent.ClickDetector.MouseClick:Connect(function()
	if isopen == false then
		isopen = true
		script.Parent.DoorOpen:Play()
		doormotor.Motor.DesiredAngle = -1.4
	else
		isopen = false
		script.Parent.DoorClose:Play()
		doormotor.Motor.DesiredAngle = 0
	end
end)