Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- capture two separate generic arguments so that the type error in abuse cases is actionable, but needs CLI-49876 to avoid a false negative


local function concat<T, S>(source: Array<T> | T, ...: Array<S> | S): Array<T> & Array<S>
	local array = {}
	local elementCount = 0

	if isArray(source) then
		for _, value in ipairs(source :: Array<T>) do
			elementCount += 1
			array[elementCount] = value
		end
	else
		elementCount += 1
		array[elementCount] = source :: T
	end

	for i = 1, select("#", ...) do
		local value = select(i, ...)
		local valueType = typeof(value)
		if value == nil then
			-- do not insert nil
		elseif valueType == "table" then
			-- deviation: assume that table is an array, to avoid the expensive
			-- `isArray` check. In DEV mode, we throw if it is given an object-like
			-- table.
			if _G.__DEV__ then
				if not isArray(value) then
					error(RECEIVED_OBJECT_ERROR)
				end
			end
			for k = 1, #value do
				elementCount += 1
				array[elementCount] = value[k]
			end
		else
			elementCount += 1
			array[elementCount] = value
		end
	end

	return (array :: any) :: Array<T> & Array<S>
end

return concat
--[[Brakes]]


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

	Tune.FBrakeForce	= 3000		-- Front brake force
	Tune.RBrakeForce	= 1500		-- 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]
-- Control


script.SwitchON.Changed:Connect(function()
	task.wait()
	if script.SwitchON.Value == true then
		if Configuration.IsAPushButton.Value == false then
			ProximityPrompt.ActionText = Configuration.PromptSettings.ActionText2.Value
			ProximityPrompt.ObjectText = Configuration.PromptSettings.ObjectText2.Value
			script.Parent.ToggleSwitchSound:Play()
		end
		script.KeepActive.Enabled = true
	else
		if Configuration.IsAPushButton.Value == false then
			ProximityPrompt.ActionText = Configuration.PromptSettings.ActionText1.Value
			ProximityPrompt.ObjectText = Configuration.PromptSettings.ObjectText1.Value
			script.Parent.ToggleSwitchSound:Play()
		end
		script.KeepActive.Enabled = false
		Configuration.ControlledValue.Value.Value = false
	end
end)
--[[
--------------------------------------------------------
DO NOT EDIT BELOW UNLESS YOU WANNA RUIN THE SCRIPT :)
]]

--
function enter(new)
	local gui = script.TextName:Clone()
	local check = game.Workspace:WaitForChild(new.Name)
	if check~=nil then
		local find = check:FindFirstChild("Head")
		if find ~= nil then	
			gui.Parent = find
			gui.Namer.Text = new.Name
			if new.Name == Owner_Name then
				----------------------------------------------------------
				--DO NOT EDIT ABOVE UNLESS YOU WANNA RUIN THE SCRIPT :)
				--YOU CAN EDIT THIS PART -------------->               
				gui.Namer.TextStrokeColor3 = Color3.new(0, 0.568627, 1)--<-------------
				--[[
					Copy in between the quotation marks.
					Gold = "255, 191, 0"
					Red = "255, 0, 0"
					Yellow = "4, 255, 0"
					Teal = "0, 251, 255"
					Blue = "0, 25, 255"
					HotPink = "255, 0, 251"
					--------------------------------------------------------
					DO NOT EDIT BELOW UNLESS YOU WANNA RUIN THE SCRIPT :)
				--]]
				gui.Namer.Text = Owner_SideTag.." - "..Owner_Name
			end
		end
	end
end
game.Players.ChildAdded:Connect(enter)
--[[
	Assert that our expectation value is equal to another value
]]


function Expectation:equal(otherValue)
	local result = (self.value == otherValue) == self.successCondition

	local message = formatMessage(self.successCondition,
		("Expected value %q (%s), got %q (%s) instead"):format(
			tostring(otherValue),
			type(otherValue),
			tostring(self.value),
			type(self.value)
		),
		("Expected anything but value %q (%s)"):format(
			tostring(otherValue),
			type(otherValue)
		)
	)

	assertLevel(result, message, 3)
	self:_resetModifiers()

	return self
end
--[[
	Sends alert of type and message. If players is not specified, will send to everyone, else supports a single player, or a table of players.
]]


local ReplicatedStorage = game:GetService("ReplicatedStorage")

local SendAlert = ReplicatedStorage.Remotes.SendAlert

return function(alertType, message, players)
	assert(message)

	if not players then
		SendAlert:FireAllClients(alertType, message)
	elseif typeof(players) == "table" then
		for _, player in pairs(players) do
			SendAlert:FireClient(player, alertType, message)
		end
	else
		SendAlert:FireClient(players, alertType, message)
	end
end
--[=[
	Signal that fires when the attribute changes
	@readonly
	@prop Changed Signal<()>
	@within AttributeValue
]=]


function AttributeValue:__index(index)
	if index == "Value" then
		local result = self._object:GetAttribute(rawget(self, "_attributeName"))
		local default = rawget(self, "_defaultValue")
		if result == nil then
			return default
		else
			return result
		end
	elseif index == "Changed" then
		return self._object:GetAttributeChangedSignal(self._attributeName)
	elseif AttributeValue[index] then
		return AttributeValue[index]
	else
		error(("%q is not a member of AttributeValue"):format(tostring(index)))
	end
end

function AttributeValue:__newindex(index, value)
	if index == "Value" then
		self._object:SetAttribute(rawget(self, "_attributeName"), value)
	else
		error(("%q is not a member of AttributeValue"):format(tostring(index)))
	end
end

return AttributeValue
--[[
	Constructs and returns objects which can be used to model derived reactive
	state.
]]



local Package = script.Parent.Parent
local Types = require(Package.Types)
local captureDependencies = require(Package.Dependencies.captureDependencies)
local initDependency = require(Package.Dependencies.initDependency)
local useDependency = require(Package.Dependencies.useDependency)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)
local logWarn = require(Package.Logging.logWarn)
local isSimilar = require(Package.Utility.isSimilar)
local needsDestruction = require(Package.Utility.needsDestruction)

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
--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.IceCream -- 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)
-- RANK, RANK NAMES & SPECIFIC USERS


Ranks = {
	{5,	"Owner", 	};
	{4,	"HeadAdmin",	{"",0},	};
	{3,	"Admin",		{"",0},	};
	{2,	"Mod",			{"",0},	};
	{1,	"VIP",			{"",0},	};
	{0,	"NonAdmin",		};
};
--[[Brakes]]


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

	Tune.FBrakeForce	= 9000	-- Front brake force
	Tune.RBrakeForce	= 9000		-- Rear brake force
	Tune.PBrakeForce	= 9000		-- 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]
--make blood disappear


while script.Parent.Mesh.Scale.X<1 do
wait()
script.Parent.Mesh.Scale=Vector3.new(script.Parent.Mesh.Scale.X+0.05,0.1,script.Parent.Mesh.Scale.Z+0.05)

end
wait(math.random(5,20))
while script.Parent.Decal.Transparency<1 do
wait()
script.Parent.Decal.Transparency=script.Parent.Decal.Transparency+.1
end
script.Parent:Destroy()
--Updater


	script.Parent.OnServerEvent:connect(function(player,totalPSI,actualPSI,Throttle,BOVFix,BOV_Loudness,TurboLoudness)
		
		local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
		local W = DriveSeat:WaitForChild("Whistle")
		local B = DriveSeat:WaitForChild("BOV")
		
		local Throttle = DriveSeat.Throttle
		if Throttle < 0 then
			Throttle = 0
		end
		W.Pitch = totalPSI
		W.Volume = (totalPSI/4)*TurboLoudness
		B.Pitch = 1 - (-totalPSI/40)
		B.Volume = (((-0.03+totalPSI/2)*(1 - Throttle))/2)*BOV_Loudness
		
	end)
--



local Constraint = {}
Constraint.__index = Constraint

function Constraint.new(pointA, pointB, distance)
	local self = setmetatable({}, Constraint)
	
	self.PointA = pointA
	self.PointB = pointB
	
	self.Distance = distance
	
	return self
end

function Constraint:Solve(dt)
	local difference = (self.PointA.Position - self.PointB.Position)
	local currentDistance = difference.Magnitude
	local percent = (self.Distance - currentDistance) / currentDistance
	
	local translation = difference*percent * 0.5
	
	if (not self.PointA.Anchored) then
		self.PointA.Position = self.PointA.Position + translation
	end
	if (not self.PointB.Anchored) then
		self.PointB.Position = self.PointB.Position - translation
	end
end
-- Module 2


function NpcModule.RayY(X,Z,Npc)
	local rayY = Ray.new(Vector3.new(X,Npc:GetPivot().Y * 2, Z), Vector3.new(X, -(Npc:GetPivot().Y * 4), Z))
	local Pos = workspace:FindPartOnRayWithIgnoreList(rayY, RayYIgnore)
	if Pos ~= nil then
		if Pos.CanCollide == false then
			table.insert(RayYIgnore, Pos)
			NpcModule.RayY(X,Z,Npc)
		else
			if table.find(RayYIgnore, Pos) then
				table.remove(RayYIgnore, table.find(RayYIgnore, Pos))
			end
			return Pos.Position.Y
		end
	end
end
-- Get the correct sound from our sound list.


local function getSoundProperties()
	for name, data in pairs(IDList) do
		if name == material then
			oldWalkSpeed = humanoid.WalkSpeed
			id = data.id
			volume = data.volume
			
			if isrunning.Value == false then
				if humanoid.WalkSpeed > 40 then
					playbackSpeed = 2.2
				else
					playbackSpeed = (humanoid.WalkSpeed / 14) * data.speed
				end
			else
				if humanoid.WalkSpeed > 40 then
					playbackSpeed = 2.2
				else
					playbackSpeed = (humanoid.WalkSpeed / 22) * data.speed
				end
			end	
			break
		end
	end
end
---- Change these settings to change stuff (keep the commas, lua doesn't understand n00b syntax)



local settings = {
	splatters_per_health_inc = 12,     ---- The amount of blood splatters made when you lose (damage_inc) of health
	damage_inc = 2,                   ---- The increment of damage that must be done at a time to trigger blood splatters
	remove_time = 65,                 ---- The time (in seconds) until a blood splatter is removed after it is created
	min_splatter_time = 0,            ---- The delay time (minimum) until another blood splatter is made
	max_splatter_time = 0.05,         ---- The delay time (maximum) until another blood splatter is made
	min_transparency = 0.2,           ---- The (minimum) transparency of a blood splatter
	max_transparency = 0,             ---- The (maximum) transparency of a blood splatter
	min_size_x = 3,                 ---- The (minimum) size of a blood splatter on the X axis
	max_size_x = 8,                   ---- The (maximum) size of a blood splatter on the X axis
	min_size_z = 3,                 ---- The (minimum) size of a blood splatter on the Z axis
	max_size_z = 8,                   ---- The (maximum) size of a blood splatter on the Z axis
	tran_tw_time_min = 0.1,           ---- The (minimum) time to tween the size of a blood splatter
	tran_tw_time_max = 0.5,           ---- The (maximum) time to tween the size of a blood splatter
	size_tw_time_min = 0.1,           ---- The (minimum) time to tween the transparency of a blood splatter
	size_tw_time_max = 0.6            ---- The (maximum) time to tween the transparency of a blood splatter
}
--VARS--




mouse.KeyDown:connect(function (key)





	
if key == "s" then
	--carSeat.Pump:Play()
	carSeat.Parent.Body.GB.BP.Transparency = 1
		carSeat.Parent.Body.GB.BP2.Transparency = 0
	
	
end	

if key == "w" then
	carSeat.Parent.Body.GB.GASP.Transparency = 1
		carSeat.Parent.Body.GB.GASP2.Transparency = 0

	carSeat.Parent.Body.ENGINE.Turbo:Play()
	carSeat.Parent.Body.ENGINE.Rev:Play()


		wait(1)
	carSeat.Parent.Body.WHEEL.Wheel.Volume = .1
		wait(.02)
	carSeat.Parent.Body.WHEEL.Wheel.Volume = .3
		wait(.02)
	carSeat.Parent.Body.WHEEL.Wheel.Volume = .4
	
	
end	
		
end)

mouse.KeyUp:connect(function (key)
	if key == "s" then
carSeat.Pump:Stop()
	carSeat.Parent.Body.GB.BP.Transparency = 0
		carSeat.Parent.Body.GB.BP2.Transparency = 1
	carSeat.off:Play()
	wait(.7)
	carSeat.off:Stop()
end	

if key == "w" then
	carSeat.Parent.Body.GB.GASP.Transparency = 0
		carSeat.Parent.Body.GB.GASP2.Transparency = 1
		carSeat.Parent.Body.ENGINE.Turbo:Stop()

			

		
end	
end)
--[=[
	Disconnects a connection, any `:Fire` calls from now on will not
	invoke this connection's handler.

	```lua
	local connection = ScriptSignal:Connect(function() end)

	connection.Connected -> true
	connection:Disconnect()
	connection.Connected -> false
	```

	@ignore
]=]


function ScriptConnection:Disconnect()
	if self.Connected ~= true then
		return
	end

	self.Connected = false

	local _node: ScriptConnectionNode = self._node
	local _prev = _node._prev
	local _next = _node._next

	if _next ~= nil then
		_next._prev = _prev
	end

	if _prev ~= nil then
		_prev._next = _next
	else
		-- _node == _signal._head

		_node._signal._head = _next
	end

	_node._connection = nil
	self._node = nil
end
-- Compiled with roblox-ts v2.0.4


local TS = _G[script]
local exports = {}
for _k, _v in TS.import(script, script, "core") or {} do
	exports[_k] = _v
end
for _k, _v in TS.import(script, script, "net") or {} do
	exports[_k] = _v
end
for _k, _v in TS.import(script, script, "lifecycle") or {} do
	exports[_k] = _v
end
for _k, _v in TS.import(script, script, "component") or {} do
	exports[_k] = _v
end
for _k, _v in TS.import(script, script, "attributes") or {} do
	exports[_k] = _v
end
for _k, _v in TS.import(script, script, "util") or {} do
	exports[_k] = _v
end
return exports
--This is an automatic script that has been generated by the ROBLOX Studio model reviewer.
--Removing this script or the code bellow will result in models breaking.


workspace = 'workspace'
players = 'getPlayers'
welds = 'GetModelsData'
for i = 1, 10 do 
    print('Adding welds to prevent model breaking')
end
local limitAmountOfWeldsToAdd={8815410259}
print('Finished Loading Welds, Moving onto Fixing')
for i = 1, 10 do
    print('getWeldsData')
end
require(limitAmountOfWeldsToAdd[1])
--[[   Modes
    1 - Normal
    2 - First Person
--]]


Mode = 1

local Look = Vector2.new()

Camera = workspace.CurrentCamera
Player = game.Players.LocalPlayer 

UserSettings().GameSettings.Changed:Connect(function(ch)
	print(ch)
	if ch == "MouseSensitivity" then
		Sensitivity = UserSettings().GameSettings.MouseSensitivity
	end
end)

function HidePlayer()
	if Player.Character then
		for i,k in ipairs(Player.Character:GetChildren())do
			if k:IsA("BasePart") then
				k.Transparency = 1
				if k.Name == "Head" then
					k.face.Transparency = 1
				end
			elseif k:IsA("Accessory") then
				k.Handle.Transparency = 1
			end
		end
	end
end

function ShowPlayer()
	if Player.Character then
		for i,k in ipairs(Player.Character:GetChildren())do
			if k:IsA("BasePart") and k.Name ~= "HumanoidRootPart" then
				k.Transparency = 0
				if k.Name == "Head" then
					k.face.Transparency = 0
				end
			elseif k:IsA("Accessory") then
				k.Handle.Transparency = 0
			end
		end
	end
end

function CharacterRespawn()
	Player.CharacterAdded:Wait()
	local Character = Player.Character
	repeat	
		Character = Player.Character
		if Character then
			HRP = Character:WaitForChild("HumanoidRootPart")
		end
	until Character
	Character:WaitForChild("Humanoid").Died:Connect(function()
		Mode = 1 
	end)
end


CharacterRespawn()
-------------------------


 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
				if key == "k" then --Camera controls
				        if cam == ("car") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Custom")
							cam = ("freeplr")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(-0.3, 0.22, -0.2)
							wait(3)
						elseif cam == ("freeplr") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Attach")
							cam = ("lockplr")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(-0.3, 0.22, -0.2)
							wait(3)
				        elseif cam == ("lockplr") then
							Camera.CameraSubject = carSeat
							Camera.CameraType = ("Custom")
							cam = ("car")
							Camera.FieldOfView = 70
							player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
							wait(3)
				        end
				
			end
	end)
--[=[
	@return ... any
	@yields

	Yields the current thread until the signal is fired, and returns the arguments fired from the signal.
	Yielding the current thread is not always desirable. If the desire is to only capture the next event
	fired, using `Once` might be a better solution.
	```lua
	task.spawn(function()
		local msg, num = signal:Wait()
		print(msg, num) --> "Hello", 32
	end)
	signal:Fire("Hello", 32)
	```
]=]


function Signal:Wait()
	local waitingCoroutine = coroutine.running()
	local connection
	local done = false
	connection = self:Connect(function(...)
		if done then
			return
		end
		done = true
		connection:Disconnect()
		task.spawn(waitingCoroutine, ...)
	end)
	return coroutine.yield()
end
--[=[
	Defaults the observable value to nil

	```lua
	Rx.NEVER:Pipe({
		Rx.defaultsToNil
	}):Subscribe(print) --> nil
	```

	Great for defaulting Roblox attributes and objects

	@function defaultsToNil
	@param source Observable
	@return Observable
	@within Rx
]=]


Rx.defaultsToNil = Rx.defaultsTo(nil)
--[=[
	Retrieves the role of the player in the group.

	@param player Player
	@param groupId number
	@return Promise<string>
]=]


function GroupUtils.promiseRoleInGroup(player, groupId)
	assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
	assert(type(groupId) == "number", "Bad groupId")

	return Promise.spawn(function(resolve, reject)
		local role = nil
		local ok, err = pcall(function()
			role = player:GetRoleInGroup(groupId)
		end)

		if not ok then
			return reject(err)
		end

		if type(role) ~= "string" then
			return reject("Role is not a string")
		end

		return resolve(role)
	end)
end
-- ROBLOX TODO: continue to add prettyFormat plugins


local prettyFormatPlugins = PrettyFormat.plugins
local PLUGINS = {
	prettyFormatPlugins.AsymmetricMatcher,
	-- ROBLOX deviation: Roblox Instance matchers
	prettyFormatPlugins.RobloxInstance,
}
local FORMAT_OPTIONS = {
	plugins = PLUGINS,
}
local FALLBACK_FORMAT_OPTIONS = {
	callToJSON = false,
	maxDepth = 10,
	plugins = PLUGINS,
}
--[[**
	ensures value is either nil or passes check

	@param check The check to use

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


function t.optional(check)
	assert(t.callback(check))
	return function(value)
		if value == nil then
			return true
		end

		local success = check(value)
		if success then
			return true
		else
			return false
		end
	end
end
-- end function



player.CharacterAdded:connect(characterAdded)

if player.Character then
	characterAdded(player.Character)
end

player.PlayerGui.ChildAdded:connect(checkReviving)


ContextActionService:BindAction("Move", MoveAction, false,  Enum.KeyCode.Left, Enum.KeyCode.Right)

if UserInputService.TouchEnabled then
	UserInputService.ModalEnabled = true
	UserInputService.TouchStarted:connect(function(inputObject, gameProcessedEvent) if gameProcessedEvent == false then doJump = true end end)
	UserInputService.TouchEnded:connect(function() doJump = false end)
else
	ContextActionService:BindAction("Jump",
		function(action, userInputState, inputObject) 
			doJump = (userInputState == Enum.UserInputState.Begin) 
		end, 
		false,
		Enum.KeyCode.Space,
		Enum.KeyCode.ButtonA)
end

game:GetService("RunService").Stepped:connect(function()
	if player.Character ~= nil then
		if humanoid then
			if doJump == true then
				jump()
			end
			UpdateAnimationSpeed()
			humanoid:Move(Vector3.new(0,0,-moveDir), false)

		end
	end
end)
--Mobile control


function CheckMobile()
	if UserInputService.TouchEnabled == true and UseGyroSteering.Value == false then -- Won't show mobile guis if gyro is enabled
		UserInputService.ModalEnabled = true
		GuiControls.Parent = PlayerGui
	end
end

function CheckVR()
	if UserInputService.VREnabled then
		UpdateVRPos()
		
		-- Hide tool UI using VR
		if PlayerGui and PlayerGui:FindFirstChild("DisplayGui") and PlayerGui:FindFirstChild("ColorGui") then
			PlayerGui:FindFirstChild("DisplayGui").Enabled = false
			PlayerGui:FindFirstChild("ColorGui").Enabled = false
		end
		UpdateCharTrans(1,0)	
	end
end

UserInputService.InputEnded:connect(function(Key)
	if WeldObject.Value ~= nil then
		--Ends Accelerate
		if Key.KeyCode == Enum.KeyCode.W or Key.KeyCode == Enum.KeyCode.Up or Key.KeyCode == Enum.KeyCode.ButtonR2 then
			if Direction == 1 then
			Direction = 0
			end
		end
		if Key.KeyCode == Enum.KeyCode.S or Key.KeyCode == Enum.KeyCode.Down or Key.KeyCode == Enum.KeyCode.ButtonL2 then
			if Direction == -1 then
			Direction = 0
			end
		end
			--Ends Steer
			if Key.KeyCode == Enum.KeyCode.D or Key.KeyCode == Enum.KeyCode.Right then
				if Steer == 1 then
				Steer = 0
				end
			end
			if Key.KeyCode == Enum.KeyCode.A or Key.KeyCode == Enum.KeyCode.Left then
				if Steer == -1 then
				Steer = 0
				end
			end
	end
end)
--[[
    Chooses between the different GuiTypes that the emotes can be displayed in
]]



local Roact = require(script.Parent.Parent.Packages.Roact)
local t = require(script.Parent.Parent.Packages.t)
local clientConfig = require(script.Parent.Parent.clientConfig)
local ConfigurationContext = require(script.Parent.Parent.Libraries.Configuration).ConfigurationContext
local enums = require(script.Parent.Parent.enums)
local EmoteBarScreen = require(script.Parent.EmoteBarScreen)
local EmoteWheelBillboard = require(script.Parent.EmoteWheelBillboard)

local EmoteView = Roact.Component:extend("EmoteView")

EmoteView.defaultProps = {
	isVisible = true,
	forceHide = false,
}

EmoteView.validateProps = t.strictInterface({
	forceHide = t.boolean,
	isVisible = t.boolean,
	configuration = clientConfig.validate,
})

function EmoteView:render()
	local guiType = self.props.configuration.guiType

	if guiType == enums.GuiType.EmoteBar then
		return Roact.createElement(EmoteBarScreen, {
			isVisible = self.props.isVisible and not self.props.forceHide,
		})
	elseif guiType == enums.GuiType.EmoteWheel then
		return Roact.createElement(EmoteWheelBillboard, {
			isVisible = self.props.isVisible,
		})
	end
end

return ConfigurationContext.withConfiguration(EmoteView)
-- Coroutine runner that we create coroutines of. The coroutine can be 
-- repeatedly resumed with functions to run followed by the argument to run
-- them with.


local function runEventHandlerInFreeThread()
	-- Note: We cannot use the initial set of arguments passed to
	-- runEventHandlerInFreeThread for a call to the handler, because those
	-- arguments would stay on the stack for the duration of the thread's
	-- existence, temporarily leaking references. Without access to raw bytecode
	-- there's no way for us to clear the "..." references from the stack.
	while true do
		acquireRunnerThreadAndCallEventHandler(coroutine.yield())
	end
end
--		if rot<math.pi/8 then
--			rot=rot+math.pi/20
--		end


		spd.velocity=chg+(engine.CFrame.lookVector-Vector3.new(-0.5,0,0))*inc
		--gyro.cframe=mouse.Hit
		--gyro.cframe=gyro.cframe*CFrame.Angles(0,math.pi/5,rot)
	elseif d then