Pinkstack/roblox-luau-corpus-text huggingface dataset:
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{73,76,72,71,61,59,41,30,56,58},t},
[49]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{73,76,72,71,61,59,41,30,56,58,20,19},t},
[59]={{73,76,72,71,61,59},t},
[63]={{73,76,72,71,61,59,41,30,56,58,23,62,63},t},
[34]={{73,76,72,71,61,59,41,39,35,34},t},
[21]={{73,76,72,71,61,59,41,30,56,58,20,21},t},
[48]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{73,76,72,71,61,59,41,39,35,34,32,31},t},
[56]={{73,76,72,71,61,59,41,30,56},t},
[29]={{73,76,72,71,61,59,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45},t},
[57]={{73,76,72,71,61,59,41,30,56,57},t},
[36]={{73,76,72,71,61,59,41,39,35,37,36},t},
[25]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{73,76,72,71},t},
[20]={{73,76,72,71,61,59,41,30,56,58,20},t},
[60]={{73,76,72,71,61,60},t},
[8]={n,f},
[4]={n,f},
[75]={{73,75},t},
[22]={{73,76,72,71,61,59,41,30,56,58,20,21,22},t},
[74]={{73,74},t},
[62]={{73,76,72,71,61,59,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{73,76,72,71,61,59,41,39,35,37},t},
[2]={n,f},
[35]={{73,76,72,71,61,59,41,39,35},t},
[53]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{73},t},
[72]={{73,76,72},t},
[33]={{73,76,72,71,61,59,41,39,35,37,36,33},t},
[69]={{73,76,72,71,61,69},t},
[65]={{73,76,72,71,61,59,41,30,56,58,20,19,66,64,65},t},
[26]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26},t},
[68]={{73,76,72,71,61,59,41,30,56,58,20,19,66,64,67,68},t},
[76]={{73,76},t},
[50]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{73,76,72,71,61,59,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{73,76,72,71,61,59,41,30,56,58,23},t},
[44]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44},t},
[39]={{73,76,72,71,61,59,41,39},t},
[32]={{73,76,72,71,61,59,41,39,35,34,32},t},
[3]={n,f},
[30]={{73,76,72,71,61,59,41,30},t},
[51]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{73,76,72,71,61,59,41,30,56,58,20,19,66,64,67},t},
[61]={{73,76,72,71,61},t},
[55]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{73,76,72,71,61,59,41,39,40,38,42},t},
[40]={{73,76,72,71,61,59,41,39,40},t},
[52]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{73,76,72,71,61,59,41},t},
[17]={n,f},
[38]={{73,76,72,71,61,59,41,39,40,38},t},
[28]={{73,76,72,71,61,59,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{73,76,72,71,61,59,41,30,56,58,20,19,66,64},t},
}
return r
--// Rest of code after waiting for correct events.



local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

while not LocalPlayer do
	Players.ChildAdded:wait()
	LocalPlayer = Players.LocalPlayer
end

local canChat = true

local ChatDisplayOrder = 6
if ChatSettings.ScreenGuiDisplayOrder ~= nil then
	ChatDisplayOrder = ChatSettings.ScreenGuiDisplayOrder
end

local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local GuiParent = Instance.new("ScreenGui")
GuiParent.Name = "Chat"
GuiParent.ResetOnSpawn = false
GuiParent.DisplayOrder = ChatDisplayOrder
GuiParent.Parent = PlayerGui

local DidFirstChannelsLoads = false

local modulesFolder = script

local moduleChatWindow = require(modulesFolder:WaitForChild("ChatWindow"))
local moduleChatBar = require(modulesFolder:WaitForChild("ChatBar"))
local moduleChannelsBar = require(modulesFolder:WaitForChild("ChannelsBar"))
local moduleMessageLabelCreator = require(modulesFolder:WaitForChild("MessageLabelCreator"))
local moduleMessageLogDisplay = require(modulesFolder:WaitForChild("MessageLogDisplay"))
local moduleChatChannel = require(modulesFolder:WaitForChild("ChatChannel"))
local moduleCommandProcessor = require(modulesFolder:WaitForChild("CommandProcessor"))

local ChatWindow = moduleChatWindow.new()
local ChannelsBar = moduleChannelsBar.new()
local MessageLogDisplay = moduleMessageLogDisplay.new()
local CommandProcessor = moduleCommandProcessor.new()
local ChatBar = moduleChatBar.new(CommandProcessor, ChatWindow)

ChatWindow:CreateGuiObjects(GuiParent)

ChatWindow:RegisterChatBar(ChatBar)
ChatWindow:RegisterChannelsBar(ChannelsBar)
ChatWindow:RegisterMessageLogDisplay(MessageLogDisplay)

MessageCreatorUtil:RegisterChatWindow(ChatWindow)

local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
MessageSender:RegisterSayMessageFunction(EventFolder.SayMessageRequest)



if (UserInputService.TouchEnabled) then
	ChatBar:SetTextLabelText(ChatLocalization:Get("GameChat_ChatMain_ChatBarText",'Tap here to chat'))
else
	ChatBar:SetTextLabelText(ChatLocalization:Get("GameChat_ChatMain_ChatBarTextTouch",'To chat click here or press "/" key'))
end

spawn(function()
	local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
	local animationFps = ChatSettings.ChatAnimationFPS or 20.0

	local updateWaitTime = 1.0 / animationFps
	local lastTick = tick()
	while true do
		local currentTick = tick()
		local tickDelta = currentTick - lastTick
		local dtScale = CurveUtil:DeltaTimeToTimescale(tickDelta)

		if dtScale ~= 0 then
			ChatWindow:Update(dtScale)
		end

		lastTick = currentTick
		wait(updateWaitTime)
	end
end)
--[=[
	Cleans up all tasks and removes them as entries from the Maid.

	:::note
	Signals that are already connected are always disconnected first. After that
	any signals added during a cleaning phase will be disconnected at random times.
	:::

	:::tip
	DoCleaning() may be recursively invoked. This allows the you to ensure that
	tasks or other tasks. Each task will be executed once.

	However, adding tasks while cleaning is not generally a good idea, as if you add a
	function that adds itself, this will loop indefinitely.
	:::
]=]


function Maid:DoCleaning()
	local tasks = self._tasks

	-- Disconnect all events first as we know this is safe
	for index, job in pairs(tasks) do
		if typeof(job) == "RBXScriptConnection" then
			tasks[index] = nil
			job:Disconnect()
		end
	end

	-- Clear out tasks table completely, even if clean up tasks add more tasks to the maid
	local index, job = next(tasks)
	while job ~= nil do
		tasks[index] = nil
		if type(job) == "function" then
			job()
		elseif type(job) == "thread" then
			local cancelled
			if coroutine.running() ~= job then
				cancelled = pcall(function()
					task.cancel(job)
				end)
			end

			if not cancelled then
				local toCancel = job
				task.defer(function()
					task.cancel(toCancel)
				end)
			end
		elseif typeof(job) == "RBXScriptConnection" then
			job:Disconnect()
		elseif job.Destroy then
			job:Destroy()
		end
		index, job = next(tasks)
	end
end
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{75,73,76,72,71,61,59,41,30,56,58},t},
[49]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{75,73,76,72,71,61,59,41,30,56,58,20,19},t},
[59]={{75,73,76,72,71,61,59},t},
[63]={{75,73,76,72,71,61,59,41,30,56,58,23,62,63},t},
[34]={{75,73,76,72,71,61,59,41,39,35,34},t},
[21]={{75,73,76,72,71,61,59,41,30,56,58,20,21},t},
[48]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{75,73,76,72,71,61,59,41,39,35,34,32,31},t},
[56]={{75,73,76,72,71,61,59,41,30,56},t},
[29]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45},t},
[57]={{75,73,76,72,71,61,59,41,30,56,57},t},
[36]={{75,73,76,72,71,61,59,41,39,35,37,36},t},
[25]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{75,73,76,72,71},t},
[20]={{75,73,76,72,71,61,59,41,30,56,58,20},t},
[60]={{75,73,76,72,71,61,60},t},
[8]={n,f},
[4]={n,f},
[75]={{75},t},
[22]={{75,73,76,72,71,61,59,41,30,56,58,20,21,22},t},
[74]={{75,73,74},t},
[62]={{75,73,76,72,71,61,59,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{75,73,76,72,71,61,59,41,39,35,37},t},
[2]={n,f},
[35]={{75,73,76,72,71,61,59,41,39,35},t},
[53]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{75,73},t},
[72]={{75,73,76,72},t},
[33]={{75,73,76,72,71,61,59,41,39,35,37,36,33},t},
[69]={{75,73,76,72,71,61,69},t},
[65]={{75,73,76,72,71,61,59,41,30,56,58,20,19,66,64,65},t},
[26]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26},t},
[68]={{75,73,76,72,71,61,59,41,30,56,58,20,19,66,64,67,68},t},
[76]={{75,73,76},t},
[50]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{75,73,76,72,71,61,59,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{75,73,76,72,71,61,59,41,30,56,58,23},t},
[44]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44},t},
[39]={{75,73,76,72,71,61,59,41,39},t},
[32]={{75,73,76,72,71,61,59,41,39,35,34,32},t},
[3]={n,f},
[30]={{75,73,76,72,71,61,59,41,30},t},
[51]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{75,73,76,72,71,61,59,41,30,56,58,20,19,66,64,67},t},
[61]={{75,73,76,72,71,61},t},
[55]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{75,73,76,72,71,61,59,41,39,40,38,42},t},
[40]={{75,73,76,72,71,61,59,41,39,40},t},
[52]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{75,73,76,72,71,61,59,41},t},
[17]={n,f},
[38]={{75,73,76,72,71,61,59,41,39,40,38},t},
[28]={{75,73,76,72,71,61,59,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{75,73,76,72,71,61,59,41,30,56,58,20,19,66,64},t},
}
return r
-- server script (ServerScriptService) 


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

local function loadGuis(player)
	local guisFolder = ReplicatedStorage:FindFirstChild("GUIFolder")
	if guisFolder then
		for _, gui in ipairs(guisFolder:GetChildren()) do
			if gui:IsA("ScreenGui") then
				local clonedGui = gui:Clone()
				clonedGui.Parent = player:WaitForChild("PlayerGui")
			end
		end
	end
end

Players.PlayerAdded:Connect(loadGuis)
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 1500		-- Front brake force
	Tune.RBrakeForce	= 100000		-- Rear brake force
	Tune.PBrakeForce	= 999999		-- 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]
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



function onSwimming(speed)
	if userAnimateScaleRun then
		speed /= getHeightScale()
	end
	if speed > 1.00 then
		local scale = 10.0
		playAnimation("swim", 0.4, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Swimming"
	else
		playAnimation("swimidle", 0.4, Humanoid)
		pose = "Standing"
	end
end

function animateTool()
	if (toolAnim == "None") then
		playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
		return
	end

	if (toolAnim == "Slash") then
		playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end

	if (toolAnim == "Lunge") then
		playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
		return
	end
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

local lastTick = 0

function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
  	local deltaTime = currentTime - lastTick
  	lastTick = currentTime

	local climbFudge = 0
	local setAngles = false

  	if (jumpAnimTime > 0) then
  		jumpAnimTime = jumpAnimTime - deltaTime
  	end

	if (pose == "FreeFall" and jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.2, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	-- Tool Animation handling
	local tool = Character:FindFirstChildOfClass("Tool")
	if tool and tool:FindFirstChild("Handle") then
		local animStringValueObject = getToolAnim(tool)

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

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

		animateTool()		
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
-- @outline // PUBLIC PROPERTIES



local UIS = game:GetService("UserInputService")

Controller.ForceMove = 0 -- Force the character to move toward mouse OR toward the direction given by keyboard
Controller.MoveDirection = Vector2.new()
Controller.ListenForInput = true
Controller.Enabled = true
Controller.SmoothTime = 0.06
Controller.Inputs = {W=0,S=0,D=0,A=0}
-----------------------



function warpPlayer(player, location)
	
	local HRP = player:WaitForChild("HumanoidRootPart")
	HRP.Position = Vector3.new(location.X, location.Y + 3, location.Z)
	
end

pad1.Touched:Connect(function(hit)
	
	if hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and bounce then
		
		bounce = false
		warpPlayer(hit.Parent, pad2.Position)
		task.wait(1)
		bounce = true
	end
	
end)

pad2.Touched:Connect(function(hit)

	if hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and bounce and padIsOneDirectional.Value == false then

		bounce = false
		warpPlayer(hit.Parent, pad1.Position)
		task.wait(1)
		bounce = true
	end

end)
--[=[
	Gives a task to the maid for cleanup, but uses an incremented number as a key.

	@param task MaidTask -- An item to clean
	@return number -- taskId
]=]


function Maid:GiveTask(maidTask)
	if not maidTask then
		error("Task cannot be false or nil", 2)
	end

	local taskId = #self._tasks+1
	self[taskId] = maidTask

	if type(maidTask) == "table" and (not maidTask.Destroy) then
		warn("[Maid.GiveTask] - Gave table task without .Destroy\n\n" .. debug.traceback())
	end

	return taskId
end
-- functions



function onDied()
	stopLoopedSounds()
	sDied:Play()
end

local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
	fallCount = fallCount + 1
	if state then
		sound.Volume = 0
		sound:Play()
		task.spawn(function()
			local t = 0
			local thisFall = fallCount
			while t < 1.5 and fallCount == thisFall do
				local vol = math.max(t - 0.3 , 0)
				sound.Volume = vol
				task.wait(0.1)
				t = t + 0.1
			end
		end)
	else
		sound:Stop()
	end
	fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end


function onStateNoStop(state, sound)
	if state then
		sound:Play()
	end
end


function onRunning(speed)
	sClimbing:Stop()
	sSwimming:Stop()
	if (prevState == "FreeFall" and fallSpeed > 0.1) then
		local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
		sLanding.Volume = vol
		sLanding:Play()
		fallSpeed = 0
	end
	if speed>0.5 then
		sRunning.Playing = true
		sRunning.Pitch = 1.85
	else
		sRunning:Stop()
	end
	prevState = "Run"
end

function onSwimming(speed)
	if (prevState ~= "Swim" and speed > 0.1) then
		local volume = math.min(1.0, speed / 350)
		sSplash.Volume = volume
		sSplash:Play()
		prevState = "Swim"
	end
	sClimbing:Stop()
	sRunning:Stop()
	sSwimming.Pitch = 1.6
	sSwimming:Play()
end

function onClimbing(speed)
	sRunning:Stop()
	sSwimming:Stop()	
	if speed>0.01 then
		sClimbing:Play()
		sClimbing.Pitch = speed / 5.5
	else
		sClimbing:Stop()
	end
	prevState = "Climb"
end
--<Action Code>--



script.Parent.Touched:connect(function(other)
	if other and game.Players:GetPlayerFromCharacter(other.Parent) then
		local player = game.Players:GetPlayerFromCharacter(other.Parent);
		local PlayerGui = player.PlayerGui
		
		if not PlayerGui:FindFirstChild("_PlayOnTouchedSound") then
			CreateSound(SoundID, Volume, player.PlayerGui);
		elseif PlayerGui:FindFirstChild("_PlayOnTouchedSound") and
			PlayerGui:FindFirstChild("_PlayOnTouchedSound").SoundId ~= "rbxassetid://"..SoundID then
			PlayerGui:FindFirstChild("_PlayOnTouchedSound"):Remove()
			
			CreateSound(SoundID, Volume, player.PlayerGui);
		end;
	end;
end);
-- Ring2 ascending


for l = 1,#lifts2 do
	if (lifts2[l].className == "Part") then
	lifts2[l].BodyPosition.position = Vector3.new((lifts2[l].BodyPosition.position.x),(lifts2[l].BodyPosition.position.y+2),(lifts2[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts2 do
	parts2[p].CanCollide = true
end
wait(0.5)
------------------------------------



function onTouched(part)
	if part.Parent ~= nil then
	local h = part.Parent:findFirstChild("Humanoid")
		if h~=nil then
			local teleportfrom=script.Parent.Enabled.Value
			if teleportfrom~=0 then
				if h==humanoid then
				return
				end
				local teleportto=script.Parent.Parent:findFirstChild(modelname)
				if teleportto~=nil then
					local torso = h.Parent.Torso
					local location = {teleportto.Position}
					local i = 1

					local x = location[i].x
					local y = location[i].y
					local z = location[i].z
				
					x = x + math.random(-0, 0)
					z = z + math.random(-0, 0)
					y = y + math.random(2, 3)

					local cf = torso.CFrame
					local lx = 0
					local ly = y
					local lz = 0
					
					script.Parent.Enabled.Value=0
					teleportto.Enabled.Value=0
					torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
					wait(0)
					script.Parent.Enabled.Value=1
					teleportto.Enabled.Value=1
				else
					print("Could not find teleporter!")
				end
			end
		end
	end
end

script.Parent.Touched:connect(onTouched)
--LockController



Closed = true

function LockUnlock()
	if script.Parent.Locked.Value == true then
		script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 0
	else
		script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 10
	end
end

script.Parent.Enclosure.Touched:connect(function(P)
	if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil  and P.Parent.CardNumber.Value == 0 then
		if Closed == true then
			script.Parent.Locked.Value = false
			Closed = 1
			LockUnlock()
			wait(1)
			Closed = false
			return
		end
		if Closed == false then
			script.Parent.Locked.Value = true
			Closed = 1
			LockUnlock()
			wait(1)
			Closed = true
			return
		end

	end
end)

LockUnlock() --Check
--Physical Util


function Util.checkDist(a,b)
	local pointA, pointB
	
	if typeof(a) == "Vector3" then
		pointA = a
	else
		pointA = a.Position
	end
	
	if typeof(b) == "Vector3" then
		pointB = b
	else
		pointB = b.Position
	end
	
	return (pointA - pointB).Magnitude
end
--[[**
		ensures value matches given interface definition strictly

		@param checkTable The interface definition

		@returns A function that will return true iff the condition is passed
	**--]]


	function t.strictInterface(checkTable)
		assert(checkInterface(checkTable))
		return function(value)
			local tableSuccess, tableErrMsg = t.table(value)
			if tableSuccess == false then
				return false, tableErrMsg or ""
			end

			for key, check in pairs(checkTable) do
				local success, errMsg = check(value[key])
				if success == false then
					return false, string.format("[interface] bad value for %s:\n\t%s", tostring(key), errMsg or "")
				end
			end

			for key in pairs(value) do
				if not checkTable[key] then
					return false, string.format("[interface] unexpected field %q", tostring(key))
				end
			end

			return true
		end
	end
end
--local newOre = EntityData.GetEntity(oreName)


		
GU.SpawnItem(oreName,1,root.CFrame*CFrame.new(0,1,0))	

end
end)
AttitudeCoroutine()


while true do
if mode == "charLock" then
targetLocation = (charRoot.CFrame*CFrame.new(-1,-2,5)).p
targetLook = charRoot.CFrame*CFrame.new(charRoot.CFrame.lookVector*1000)
end
bg.CFrame = targetLook
bp.Position = targetLocation
wait()
end
--- Effect kind of like a flashbang (for when you need to surprise the user maybe?)




return function(addTime, decayTime, color, transparency)
	--- Variables
	addTime = addTime or 1
	decayTime = decayTime or 1
	color = color or Color3.new(1, 1, 1)
	transparency = transparency or 0
	--
	local animationStartTime = tick()
	
	--- Main
	coroutine.wrap(function()
		--- Create flash gui
		local flashGui = Instance.new("Frame")
		flashGui.BackgroundTransparency = 1
		flashGui.BackgroundColor3 = color
		flashGui.Size = UDim2.new(2, 0, 2, 0)
		flashGui.AnchorPoint = Vector2.new(0.5, 0.5)
		flashGui.Position = UDim2.new(0.5, 0, 0.5, 0)
		flashGui.BorderSizePixel = 0
		flashGui.Parent = _L.GUIFX.GetHolder()
		
		--- Flash!
		if addTime > 0 then
			_L.Functions.FastTween(flashGui, {BackgroundTransparency = transparency}, {addTime, "Linear", "Out"})
			wait(addTime)
		else
			flashGui.BackgroundTransparency = transparency
		end
		
		--- Fade away flash
		if decayTime > 0 then
			_L.Functions.FastTween(flashGui, {BackgroundTransparency = 1}, {decayTime, "Sine", "Out"})
			wait(decayTime)
		else
			flashGui.BackgroundTransparency = 1
		end
		
		--- Destroy flash
		flashGui:Destroy()
	end)()
end
--[[[Default Controls]]


	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.At					,
		ToggleMouseDrive		= Enum.KeyCode.F4					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.Up					,
		Brake					= Enum.KeyCode.Down					,
		SteerLeft				= Enum.KeyCode.Left					,
		SteerRight				= Enum.KeyCode.Right				,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.W					,
		Brake2					= Enum.KeyCode.S					,
		SteerLeft2				= Enum.KeyCode.A					,
		SteerRight2				= Enum.KeyCode.D					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftShift			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.P					,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.DPadUp				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}