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



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

	end
	
end

function lerp(a, b, t)
	return a * (1-t) + (b*t)
end
--script.Parent.OO.Velocity = script.Parent.OO.CFrame.lookVector *script.Parent.Speed.Value
--script.Parent.OOO.Velocity = script.Parent.OOO.CFrame.lookVector *script.Parent.Speed.Value


script.Parent.OOOO.Velocity = script.Parent.OOOO.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.P.Velocity = script.Parent.P.CFrame.lookVector *script.Parent.Speed.Value
--- Fire


Signal.Fire = function(eventName, ...)
	--- Variables
	eventName = string.lower(eventName)
	
	--- Get/create event
	local event = GetEvent(eventName)
	
	--- Signal for visualization/tracking purposes on Debug (Client only) META AF BTW
	if (not isServer) and eventName ~= "core signal fired" then
		Signal.Fire("CORE Signal Fired", eventName)
	end
	
	--- Fire event w/ data
	event:Fire(...)
end
--[=[
	Retrieves a global remote event from the store. On the server, it constructs a new one,
	and on the client, it waits for it to exist.

	:::tip
	Consider using [PromiseGetRemoteEvent] for a non-yielding version
	:::

	```lua
	-- server.lua
	local GetRemoteEvent = require("GetRemoteEvent")

	local remoteEvent = GetRemoteEvent("testing")
	remoteEvent.OnServerEvent:Connect(print)

	-- client.lua
	local GetRemoteEvent = require("GetRemoteEvent")

	local remoteEvent = GetRemoteEvent("testing")
	remoteEvent:FireServer("Hello") --> Hello (on the server)
	```

	:::info
	If the game is not running, then a mock remote event will be created
	for use in testing.
	:::

	@yields
	@function GetRemoteEvent
	@within GetRemoteEvent
	@param name string
	@return RemoteEvent
]=]



local require = require(script.Parent.loader).load(script)

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

local ResourceConstants = require("ResourceConstants")

if not RunService:IsRunning() then
	return function(name)
		local event = Instance.new("RemoteEvent")
		event.Archivable = false
		event.Name = "Mock" .. name

		return event
	end
elseif RunService:IsServer() then
	return function(name)
		assert(type(name) == "string", "Bad name")

		local storage = ReplicatedStorage:FindFirstChild(ResourceConstants.REMOTE_EVENT_STORAGE_NAME)
		if not storage then
			storage = Instance.new("Folder")
			storage.Name = ResourceConstants.REMOTE_EVENT_STORAGE_NAME
			storage.Archivable = false
			storage.Parent = ReplicatedStorage
		end

		local event = storage:FindFirstChild(name)
		if event then
			return event
		end

		event = Instance.new("RemoteEvent")
		event.Name = name
		event.Archivable = false
		event.Parent = storage

		return event
	end
else -- RunService:IsClient()
	return function(name)
		assert(type(name) == "string", "Bad name")

		return ReplicatedStorage:WaitForChild(ResourceConstants.REMOTE_EVENT_STORAGE_NAME):WaitForChild(name)
	end
end
--// Holiday roooaaAaaoooAaaooOod


local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error,  pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, spawn, delay, task, assert =
	_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error,  pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, table.unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, task.wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, task.defer, task.delay, task, function(cond, errMsg) return cond or error(errMsg or "assertion failed!", 2) end;

local SERVICES_WE_USE = table.freeze {
	"Workspace";
	"Players";
	"Lighting";
	"ServerStorage";
	"ReplicatedStorage";
	"JointsService";
	"ReplicatedFirst";
	"ScriptContext";
	"ServerScriptService";
	"LogService";
	"Teams";
	"SoundService";
	"StarterGui";
	"StarterPack";
	"StarterPlayer";
	"GroupService";
	"MarketplaceService";
	"MarketplaceService";
	"TestService";
	"HttpService";
	"RunService";
	"InsertService";
	"NetworkServer";
}

local unique = {}
local origEnv = getfenv(); setfenv(1,setmetatable({}, {__metatable = unique}))
local locals = {}
local server = {}
local service = {}
local RbxEvents = {}
local ErrorLogs = {}
local HookedEvents = {}
local ServiceSpecific = {}
local oldReq = require
local Folder = script.Parent
local oldInstNew = Instance.new
local isModule = function(module)
	for ind, modu in pairs(server.Modules) do
		if module == modu then
			return true
		end
	end
	return false
end

local logError = function(plr, err)
	if type(plr) == "string" and not err then
		err = plr;
		plr = nil;
	end

	if server.Core and server.Core.DebugMode then
		warn("::Adonis:: Error: "..tostring(plr)..": "..tostring(err))
	end

	if server and server.Logs then
		server.Logs.AddLog(server.Logs.Errors, {
			Text = ((err and plr and tostring(plr) ..":") or "").. tostring(err),
			Desc = err,
			Player = plr
		})
	end
end
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{61,59,41,30,56,58},t},
[49]={{61,59,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{61,59,41,30,56,58,20,19},t},
[59]={{61,59},t},
[63]={{61,59,41,30,56,58,23,62,63},t},
[34]={{61,59,41,39,35,34},t},
[21]={{61,59,41,30,56,58,20,21},t},
[48]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{61,59,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{61,59,41,39,35,34,32,31},t},
[56]={{61,59,41,30,56},t},
[29]={{61,59,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{61,59,41,39,35,34,32,31,29,28,44,45},t},
[57]={{61,59,41,30,56,57},t},
[36]={{61,59,41,39,35,37,36},t},
[25]={{61,59,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{61,71},t},
[20]={{61,59,41,30,56,58,20},t},
[60]={{61,60},t},
[8]={n,f},
[4]={n,f},
[75]={{61,71,72,76,73,75},t},
[22]={{61,59,41,30,56,58,20,21,22},t},
[74]={{61,71,72,76,73,74},t},
[62]={{61,59,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{61,59,41,39,35,37},t},
[2]={n,f},
[35]={{61,59,41,39,35},t},
[53]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{61,71,72,76,73},t},
[72]={{61,71,72},t},
[33]={{61,59,41,39,35,37,36,33},t},
[69]={{61,69},t},
[65]={{61,59,41,30,56,58,20,19,66,64,65},t},
[26]={{61,59,41,39,35,34,32,31,29,28,27,26},t},
[68]={{61,59,41,30,56,58,20,19,66,64,67,68},t},
[76]={{61,71,72,76},t},
[50]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{61,59,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{61,59,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{61,59,41,30,56,58,23},t},
[44]={{61,59,41,39,35,34,32,31,29,28,44},t},
[39]={{61,59,41,39},t},
[32]={{61,59,41,39,35,34,32},t},
[3]={n,f},
[30]={{61,59,41,30},t},
[51]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{61,59,41,30,56,58,20,19,66,64,67},t},
[61]={{61},t},
[55]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{61,59,41,39,40,38,42},t},
[40]={{61,59,41,39,40},t},
[52]={{61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{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]={{61,59,41},t},
[17]={n,f},
[38]={{61,59,41,39,40,38},t},
[28]={{61,59,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{61,59,41,30,56,58,20,19,66,64},t},
}
return r
--[[
	Constructs and returns a new instance, with options for setting properties,
	event handlers and other attributes on the instance right away.
]]



local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local cleanupOnDestroy = require(Package.Utility.cleanupOnDestroy)
local Children = require(Package.Instances.Children)
local Scheduler = require(Package.Instances.Scheduler)
local defaultProps = require(Package.Instances.defaultProps)
local Observer = require(Package.State.Observer)
local logError = require(Package.Logging.logError)
local logWarn = require(Package.Logging.logWarn)

local WEAK_KEYS_METATABLE = {__mode = "k"}

local ENABLE_EXPERIMENTAL_GC_MODE = false
------------------------------------------------------------------


local Player = game.Players.LocalPlayer --This line down to line 74 set all the variables in the plane
local Character = Player.Character
local Plane = Character.Plane
local AutoCrash = Plane.AutoCrash
local Weapons = Plane.Weapons
local MainParts = Plane.MainParts
local Gear = MainParts.Gear
local Engine = MainParts.Engine
local Thrust = Engine.Thrust
local Direction = Engine.Direction
local Customize = Plane.Customize
local Tool = script.Parent
local GUI = Tool.PlaneGui
local ToolSelect = Tool.ToolSelect
local Deselect0 = Tool.Deselect0
local FireMain = Tool.FireMain
local Camera = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
---- Settings ----



local Cooldown = true
local Key ="X"


UserInputService.InputBegan:Connect(function(Input, IsTyping)
  if IsTyping then return end
  local KeyPressed = Input.KeyCode
  if KeyPressed == Enum.KeyCode[Key] and Cooldown and Character then
      Cooldown = false
 
 
      Remote:FireServer()
  
  
      wait(8)
      Cooldown = true
   end
end)
--[[
-- Unused because too expensive to be worth the benefit since you'd have to call it often
local function RealignArcToCamera(self)
    local relativeCamPos = self.cframe:inverse() * workspace.CurrentCamera.CFrame.p
    for _, v in pairs(self.segments) do
        local c = v.CFrame
        local po = c.p
        local up = c.upVector
        local lf = cross(relativeCamPos - po, up).unit
        local fr = cross(lf, up).unit
        v.CFrame = cframe(po.x, po.y, po.z, lf.x, up.x, fr.x, lf.y, up.y, fr.y, lf.z, up.z, fr.z)
    end
end
]]
--	local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration, 
--		Damage, DamageCooldown



	local configTable = model.Configurations
	local configs = {}
	local function loadConfig(configName, defaultValue)
		if configTable:FindFirstChild(configName) then
			configs[configName] = configTable:FindFirstChild(configName).Value
		else
			configs[configName] = defaultValue
		end
	end

	loadConfig("AttackRange", 3)
	loadConfig("FieldOfView", 180)
	loadConfig("AggroRange", 200)
	loadConfig("ChanceOfBoredom", .5)
	loadConfig("BoredomDuration", 10)
	loadConfig("Damage", 10)
	loadConfig("DamageCooldown", 1)
	
	local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
	local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
	local ZombieTarget = nil	
	local ZombieTargetLastLocation = nil
	
	local lastBored = os.time()	
	
	-- STATE DEFINITIONS	
	
	-- IdleState: NPC stays still. Refreshes bored timer when started to
	-- allow for random state change
	local IdleState = StateMachine.NewState()
	IdleState.Name = "Idle"
	IdleState.Action = function()
	end
	IdleState.Init = function()
		lastBored = os.time()
	end	
	
	-- SearchState: NPC wanders randomly increasing chance of spotting
	-- enemy. Refreshed bored timer when started to allow for random state
	-- change
	local SearchState = StateMachine.NewState()
	SearchState.Name = "Search"
	local lastmoved = os.time()
	local searchTarget = nil
	SearchState.Action = function()
		-- move to random spot nearby
		if model then
			local now = os.time()
			if now - lastmoved > 2 then
				lastmoved = now
				local xoff = math.random(5, 10)
				if math.random() > .5 then
					xoff = xoff * -1
				end
				local zoff = math.random(5, 10)
				if math.random() > .5 then
					zoff = zoff * -1
				end
				
				local testtarg = AIUtilities:FindCloseEmptySpace(model)
				--if testtarg then print(testtarg) else print("could not find") end
				searchTarget = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
				--local target = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
				--model.Humanoid:MoveTo(target)
				searchTarget = testtarg
			end
			if searchTarget then
				PathLib:MoveToTarget(model, searchTarget)
			end
		end
	end
	SearchState.Init = function()
		lastBored = os.time()
	end
	
	-- PursueState: Enemy has been spotted, need to give chase.
	local PursueState = StateMachine.NewState()
	PursueState.Name = "Pursue"
	PursueState.Action = function()
		-- Double check we still have target
		if ZombieTarget and model:FindFirstChild("HumanoidRootPart") and ZombieTarget:FindFirstChild("HumanoidRootPart") then
			-- Get distance to target
			local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
			-- If we're far from target use pathfinding to move. Otherwise just MoveTo
			if distance > configs["AttackRange"] + 5 then
				PathLib:MoveToTarget(model, ZombieTarget.HumanoidRootPart.Position)
			else
				model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)
-- FEATURE METHODS


function Icon:bindEvent(iconEventName, eventFunction)
	local event = self[iconEventName]
	assert(event and typeof(event) == "table" and event.Connect, "argument[1] must be a valid topbarplus icon event name!")
	assert(typeof(eventFunction) == "function", "argument[2] must be a function!")
	self._bindedEvents[iconEventName] = event:Connect(function(...)
		eventFunction(self, ...)
	end)
	return self
end

function Icon:unbindEvent(iconEventName)
	local eventConnection = self._bindedEvents[iconEventName]
	if eventConnection then
		eventConnection:Disconnect()
		self._bindedEvents[iconEventName] = nil
	end
	return self
end

function Icon:bindToggleKey(keyCodeEnum)
	assert(typeof(keyCodeEnum) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
	self._bindedToggleKeys[keyCodeEnum] = true
	return self
end

function Icon:unbindToggleKey(keyCodeEnum)
	assert(typeof(keyCodeEnum) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
	self._bindedToggleKeys[keyCodeEnum] = nil
	return self
end

function Icon:lock()
	self.locked = true
	return self
end

function Icon:unlock()
	self.locked = false
	return self
end

function Icon:setTopPadding(offset, scale)
	local newOffset = offset or 4
	local newScale = scale or 0
	self.topPadding = UDim.new(newScale, newOffset)
	self.updated:Fire()
	return self
end

function Icon:bindToggleItem(guiObjectOrLayerCollector)
	if not guiObjectOrLayerCollector:IsA("GuiObject") and not guiObjectOrLayerCollector:IsA("LayerCollector") then
		error("Toggle item must be a GuiObject or LayerCollector!")
	end
	self.toggleItems[guiObjectOrLayerCollector] = true
	return self
end

function Icon:unbindToggleItem(guiObjectOrLayerCollector)
	self.toggleItems[guiObjectOrLayerCollector] = nil
	return self
end

function Icon:_setToggleItemsVisible(bool, byIcon)
	for toggleItem, _ in pairs(self.toggleItems) do
		if not byIcon or byIcon.toggleItems[toggleItem] == nil then
			local property = "Visible"
			if toggleItem:IsA("LayerCollector") then
				property = "Enabled"
			end
			toggleItem[property] = bool
		end
	end
end
-- An hour in seconds


local RESHOWING_FREQUENCY = 60*60


function calculateShowTimes()
	local timeUntilNextShow = nil
	local timeIntoShow = nil
	local currentTime = DateTime.now().UnixTimestampMillis/1000
	local timeUntilFirstShow = FIRST_EVER_SHOW - currentTime
	if timeUntilFirstShow > 0 then
		timeUntilNextShow = timeUntilFirstShow
	else
		timeUntilNextShow = timeUntilFirstShow % RESHOWING_FREQUENCY
		timeIntoShow = RESHOWING_FREQUENCY - timeUntilNextShow
	end
	return timeUntilNextShow, timeIntoShow
end


function loadPreShowVenue()
	-- The PreShowVenue scene length needs to be adjusted to match the time until the next show.
	local timeUntilNextShow, timeIntoShow = calculateShowTimes()
	PSV_SCENE:SetAttribute("TimeLength", timeUntilNextShow)
	EventSequencer.loadScene(PSV_SCENE.Name)
end
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]




local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 120				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 140				,
		spInc			= 40				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 160	,
		spInc			= 40				, -- Increment between labelled notches
	}
}
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	 TeamKill = false					--- Enable TeamKill?
	,TeamDmgMult = 1					--- Between 0-1 | This will make you cause less damage if you hit your teammate
	
	,ReplicatedBullets = true			--- Keep in mind that some bullets will pass through surfaces...
	
	,AntiBunnyHop = true				--- Enable anti bunny hop system?
	,JumpCoolDown = 1.5					--- Seconds before you can jump again
	,JumpPower = 20						--- Jump power, default is 50
	
	,RealisticLaser = true				--- True = Laser line is invisible
	,ReplicatedLaser = true				
	,ReplicatedFlashlight = true
	
	,EnableRagdoll = true				--- Enable ragdoll death?
	,TeamTags = false					--- Aaaaaaa
	,HitmarkerSound = false				--- GGWP MLG 360 NO SCOPE xD
	,Crosshair = false					--- Crosshair for Hipfire shooters and arcade modes
	,CrosshairOffset = 5				--- Crosshair size offset
--Light off


	src.right.Value.Value = 0
	src.left.Value.Value = 0
	light.Value = false
	else
	src.right.Value.Value = 1
	src.left.Value.Value = 1
	light.Value = true
	return
	end
end
end)
src.Parent.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then 
		src:Stop()
		script.Parent:Destroy()
	end
end)
--^^^ Made by Anaminus ^^^---



function module.getSide(p,s)
	local cf = p.CFrame
	if s.x > 0 then
		return (cf*CFrame.fromAxisAngle(Vector3.new(0,-1,0),math.pi/2)).lookVector
	elseif s.x < 0 then
		return (cf*CFrame.fromAxisAngle(Vector3.new(0,1,0),math.pi/2)).lookVector
	end
	
	if s.y < 0 then
		return (cf*CFrame.fromAxisAngle(Vector3.new(-1,0,0),math.pi/2)).lookVector
	elseif s.y > 0 then
		return (cf*CFrame.fromAxisAngle(Vector3.new(1,0,0),math.pi/2)).lookVector
	end
	
	if s.z < 0 then
		return cf.lookVector
	elseif s.z > 0 then
		return -cf.lookVector
	end
end

function module.debounce(func)
	local debounce = false
	return function(...)
		if not debounce then
			debounce = true
			func(...)
			debounce = false
		end
	end
end

function module.part(p)
	local parts = {}
	local function getParts(m)
		for _,v in pairs(m:GetChildren()) do
			if v:IsA("Part") and v ~= p then
				table.insert(parts,#parts+1,v)
			elseif v:IsA("Model") then
				getParts(v)
			end
		end
	end
	getParts(game.Workspace)
	local winner = {}
	for _,q in pairs(parts) do
		local mag = (q.Position-p.Position).magnitude
		if mag < winner[1] then
			winner[1] = mag
			winner[2] = q
		end
	end
	return winner[2]
end

function module.weld(p1,p2)
	local w = Instance.new("Weld")
	w.Part0 = p1
	w.Part1 = p2
	w.C0 = p1.CFrame:inverse() * p2.CFrame
	w.Parent = p1
	return w
end
return module
--// This section of code waits until all of the necessary RemoteEvents are found in EventFolder.
--// I have to do some weird stuff since people could potentially already have pre-existing
--// things in a folder with the same name, and they may have different class types.
--// I do the useEvents thing and set EventFolder to useEvents so I can have a pseudo folder that
--// the rest of the code can interface with and have the guarantee that the RemoteEvents they want
--// exist with their desired names.



local FFlagFixChatWindowHoverOver = false do
	local ok, value = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserFixChatWindowHoverOver")
	end)
	if ok then
		FFlagFixChatWindowHoverOver = value
	end
end

local FILTER_MESSAGE_TIMEOUT = 60

local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Chat = game:GetService("Chat")
local StarterGui = game:GetService("StarterGui")

local DefaultChatSystemChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local EventFolder = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local ChatConstants = require(clientChatModules:WaitForChild("ChatConstants"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local messageCreatorModules = clientChatModules:WaitForChild("MessageCreatorModules")
local MessageCreatorUtil = require(messageCreatorModules:WaitForChild("Util"))

local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end

local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary
local waitChildren =
{
	OnNewMessage = "RemoteEvent",
	OnMessageDoneFiltering = "RemoteEvent",
	OnNewSystemMessage = "RemoteEvent",
	OnChannelJoined = "RemoteEvent",
	OnChannelLeft = "RemoteEvent",
	OnMuted = "RemoteEvent",
	OnUnmuted = "RemoteEvent",
	OnMainChannelSet = "RemoteEvent",

	SayMessageRequest = "RemoteEvent",
	GetInitDataRequest = "RemoteFunction",
}
-- 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.07,0) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)