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


d = false
function onTouched(hit)
if d == false then
h = hit.Parent:findFirstChild("Torso")
if (h~=nil) then 
d = true
gg = math.random(1,20)
if gg == 4 then
h.CFrame = h.CFrame * CFrame.Angles(0,0,math.rad(100))
end
if script.dmg.Value == true then
hum = h.Parent:findFirstChild("Humanoid")
if hum then
hum.Health = hum.Health - 25
end
end
wait(1.5)
d = false
end
end 
end
script.Parent.Parent.Touched:connect(onTouched)

while true do
bt = script.Parent
ppp = bt.Parent:GetMass()
wait(.25)
bt.force = Vector3.new(0,0,500*ppp*script.mag.Value)
wait(.25)
bt.force = Vector3.new(0,0,-500*ppp*script.mag.Value)
end
--				{ id = "slash.xml", weight = 10 } 


			},
	toollunge = {
				{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } 
			},
	wave = {
				{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } 
			},
	point = {
				{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } 
			},
	dance = {
				{ id = "http://www.roblox.com/asset/?id=130018893", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=132546839", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=132546884", weight = 10 } 
			},
	dance2 = {
				{ id = "http://www.roblox.com/asset/?id=160934142", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934298", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934376", weight = 10 } 
			},
	dance3 = {
				{ id = "http://www.roblox.com/asset/?id=160934458", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934530", weight = 10 }, 
				{ id = "http://www.roblox.com/asset/?id=160934593", weight = 10 } 
			},
	laugh = {
				{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } 
			},
	cheer = {
				{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } 
			},
}
--]]




function getHumanoid(model)
	for _, v in pairs(model:GetChildren()) do
		if v:IsA'Humanoid' then
			return v
		end
	end
end


local ai = script.Parent
local human = getHumanoid(ai)
local hroot = ai.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude


local pfs = game:GetService("PathfindingService")

function GetPlayerNames()
	local players = game:GetService('Players'):GetChildren()
	local name = nil
	for _, v in pairs(players) do
		if v:IsA'Player' then
			name = tostring(v.Name)
		end
	end
	return name
end

spawn(function()
	while wait() do
		
	end
end)

function GetPlayersBodyParts(t)
	local torso = t
	if torso then
		local figure = torso.Parent
		for _, v in pairs(figure:GetChildren()) do
			if v:IsA'Part' then
				return v.Name
			end
		end
	else
		return "HumanoidRootPart"
	end
end

function GetTorso(part)
	local chars = game.Workspace:GetChildren()
	local torso = nil
	for _, v in pairs(chars) do
		if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() then
			local charRoot = v:FindFirstChild'HumanoidRootPart'
			if (charRoot.Position - part).magnitude < SearchDistance then
				torso = charRoot
			end
		end
	end
	return torso
end

for _, zambieparts in pairs(ai:GetChildren()) do
	if zambieparts:IsA'Part' then
		zambieparts.Touched:connect(function(p)
			if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= ai.Name then -- damage
				local enemy = p.Parent
				local enemyhuman = getHumanoid(enemy)
				enemyhuman:TakeDamage(aiDamage)
			end
		end)
	end
end
-- Ammo


plr.Character.ChildAdded:connect(function(oc)
	if (oc:IsA("Tool") or oc:IsA("HopperBin")) and oc:FindFirstChild("Ammo") and oc:FindFirstChild("AmmoLeft") then 
		--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
		oc.Ammo.Changed:connect(function(v)
			--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
			gui.Ammo.Text = ""
		end)
		oc.AmmoLeft.Changed:connect(function(v)
			--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
			gui.Ammo.Text = ""
		end)
	end
end)

plr.Character.ChildRemoved:connect(function(oc)
	if (oc:IsA("Tool") or oc:IsA("HopperBin")) and oc:FindFirstChild("Ammo") and oc:FindFirstChild("AmmoLeft") then 
		gui.Ammo.Text = ""
	end
end)
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data


return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	if plrData.Money.Gold.Value > 1 then
		return true
	end
	return false
end
--[=[
	Use to test that the given GuiObject or Rect is to the right of the other GuiObject or Rect.

	The last argument is optional. If nil, the matcher will pass only if the difference **left** edge of the given GuiObject or Rect and the **right** edge of the other GuiObject or Rect is zero or positive.

	Usage:

	```lua
	expect(a).toBeRightOf(b) -- Jest
	expect(a).to.be.rightOf(b) -- TestEZ
	```

	![Example of rightOf(a, b)](/rightOf(a,%20b).png)

	```lua
	expect(a).toBeRightOf(b, 5) -- Jest
	expect(a).to.be.rightOf(b, 5) -- TestEZ
	```

	![Example of rightOf(a, b, 5)](/rightOf(a,%20b,%205).png)

	```lua
	expect(a).toBeRightOf(b, NumberRange.new(0, 5)) -- Jest
	expect(a).to.be.rightOf(b, NumberRange.new(0, 5)) -- TestEZ
	```

	![Example of rightOf(a, b, NumberRange.new(0, 5))](/rightOf(a,%20b,%20NumberRange.new(0,%205)).png)

	@tag outside
	@within CollisionMatchers2D
]=]


local function rightOf(a: GuiObject | Rect, b: GuiObject | Rect, distance: number | NumberRange)
	local aRect = toRect(a)
	local bRect = toRect(b)

	local distanceFromSide = aRect.Min - bRect.Max
	if distance then
		if typeof(distance) == "number" then
			distance = NumberRange.new(distance)
		end

		return returnValue(
			distance.Min <= distanceFromSide.X and distance.Max >= distanceFromSide.X,
			"Was within range",
			"Was not within range ( " .. tostring(distance) .. ")"
		)
	else
		return returnValue(distanceFromSide.X >= 0, "Was not left of the element", "Was to the left of the element")
	end
end

return rightOf
--[[Configuration]]

--
local looped = true -- If you set this to true, then the song that is currently playing will restart and play over again.
local pitch = 1
local volume = 1
local songPlayTime = 300 -- Seconds until the song will stop, I recommending leaving this at 120, since all ROBLOX Audios are now 120 seconds long.
local nextSongPlayTime = 3-- Seconds until the next song will be played, if you want you can leave it at 2.(2 is the default)
--!native


local Numpy = {}
local CanvasDraw = require(script.Parent.CanvasDraw)

function Numpy.Flat(val, width, height)
	local temp = {}
	for y = 0, height-1 do
		for x = 0, width-1 do
			local baseIndex = y * width * 4 + x * 4
			temp[baseIndex + 1] = val  -- Red channel
			temp[baseIndex + 2] = val  -- Green channel
			temp[baseIndex + 3] = val  -- Blue channel
			temp[baseIndex + 4] = val  -- Alpha channel
		end
	end
	return temp
end


function Numpy.Custom2(val, dim1, dim2, dim3)
	local result = {}
	for i = 0, dim1 do
		result[i] = {}
		for j = 0, dim2 do
			result[i][j] = {}
			if dim3 == nil then
				result[i][j] = val
			else
				for k = 0, dim3 do
					result[i][j][k] = val
				end
			end
		end
	end
	return result
end

function Numpy.CDrawToNumpy(data)
	local Resolution = data.ImageResolution

	local FinalTbl = {}

	for x=0, Resolution.X-1 do
		local temp = {}
		for y=0, Resolution.Y-1 do
			local PixelColor = CanvasDraw.GetPixelFromImageXY(data, x+1, y+1)
			temp[y] = {math.floor(PixelColor.R*255), math.floor(PixelColor.G*255), math.floor(PixelColor.B*255)}
		end
		FinalTbl[x] = temp
	end

	return FinalTbl, {Resolution.X, Resolution.Y}
end

function Numpy.ColorImage(Color, Resolution)
	local FinalTbl = {}
	
	for x=0, Resolution[1]-1 do
		local temp = {}
		for y=0, Resolution[2]-1 do
			temp[y] = Color
		end
		FinalTbl[x] = temp
	end

	return FinalTbl
end

return Numpy
-- When Tool Equipped


tool.Equipped:Connect(function()
	track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
	track1 = script.Parent.Parent.Humanoid:LoadAnimation(anim1)
	track.Priority = Enum.AnimationPriority.Movement
	track1.Priority = Enum.AnimationPriority.Movement
	track.Looped = true
	track:Play()
	track1:Play()
end)
--------------------------------------------------------------------------------------
--------------------[ VARIABLES ]-----------------------------------------------------
--------------------------------------------------------------------------------------



local Selected = false

local playerMass = 0

local Forward = false
local Backward = false

local Idling = false
local Walking = false
local Running = false

local crawlCamRot = 0
local crawlAlpha = 0
local idleAlpha = 1
local walkAlpha = 0
local isCrawling = false
local isIdling = false
local isWalking = false
local isRunning = false

local Aimed = false
local Aiming = false
local aimAlpha = 0
local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)

local Reloading = false
local breakReload = false
local magVisible = true
local newMag = false

local Knifing = false

local MB1Down = false
local Firing = false
local canFire = true
local fireFunction = nil
local firstShot = false
local shotCount = 0
local lastSideRecoil = {0, 0}
local recoilAnim = {
	Pos = V3();
	Rot = V3();
	Code = nil;
}

local numModes = 0
local rawFireMode = 1
local canSelectFire = true
local guiAngOffset = 0
local Modes = {}

local onGround = true
local startFallHeight = 0
local jumpAnim = {
	Pos = 0;
	Rot = 0;
	Code = 0;
}

local runReady = true
local runKeyPressed = false
local chargingStamina = false

local AimingIn = false
local AimingOut = false

local Stamina = S.sprintTime * 60
local currentSteadyTime = S.scopeSettings.steadyTime * 60

local camSteady = false
local takingBreath = false
local steadyKeyPressed = false

local Grip = nil
local aimedGripCF = nil

local spreadZoom = "unAimed"
local spreadStance = "Stand"
local spreadMotion = "Idling"
local baseSpread = S.spreadSettings.unAimed.Stand.Idling
local currentSpread = 0
local loweringSpread = false

local mouseSensitivity = S.sensitivitySettings.Default
local aimSensitivity = S.sensitivitySettings.Aim
local lastSensUpdate = 0

local ammoInClip = 0

local Stance = 0
local stanceSway = 1
local camSway = 1

local camAng = VEC2()

local armTilt = 0
local moveAng = 0
local animCode = 0

local desiredXOffset = 0
local desiredYOffset = 0
local currentXOffset = 0
local currentYOffset = 0
local aimHeadOffset = 0
local recoilAnimMultiplier = 1
local jumpAnimMultiplier = 1
local translationDivisor = 7
local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
local armTiltMultiplier = 1

local equipAnimPlaying = false

local crossOffset = 0

local camOffsets = {
	guiScope = {
		Rot = V3();
	};
	Reload = {
		Rot = V3();
		Code = nil;
	};
	Recoil = {
		Rot = V3();
		Code = nil;
	};
}

local Anim = {
	Pos = V3();
	Rot = V3();
	Ang = 0;
	Code = 0;
}

local lastBeat = 0

local gunParts = {}

local Connections = {}

local Keys = {}
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]


wait(2.5)
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local redline=0

script:WaitForChild("Rev")


for i,v in pairs(car.DriveSeat:GetChildren()) do
	for _,a in pairs(script:GetChildren()) do
		if v.Name==a.Name then v:Stop() wait() v:Destroy() end
	end
end

handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")

while wait() do
	local _RPM = script.Parent.Values.RPM.Value
	
	if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
		throt = math.max(.3,throt-.2)	
	else
		throt = math.min(1,throt+.1)	
	end	
	if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
		redline=.5
	else
		redline=1
	end
	if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
	local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
	if FE then
		handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
	else
		car.DriveSeat.Rev.Pitch = Pitch
	end
end
--------------------------------------------



game:GetService("RunService").Heartbeat:Connect(function()
	rWait(UpdateDelay)
	local TrsoLV = Trso.CFrame.lookVector
	local HdPos = Head.CFrame.p
	local player = getClosestPlayer()
	local LookAtPart
	if Neck or Waist then
		if player then
			local success, err = pcall(function()
				LookAtPart = GetValidPartToLookAt(player, PartToLookAt)
				if LookAtPart then
					local Dist = nil;
					local Diff = nil;
					local is_in_front = Core.CFrame:ToObjectSpace(LookAtPart.CFrame).Z < 0
					if is_in_front then
						if LookingAtValue.Value ~= player then
							LookingAtValue.Value = player
						end
						
						Dist = (Head.CFrame.p-LookAtPart.CFrame.p).magnitude
						Diff = Head.CFrame.Y-LookAtPart.CFrame.Y

						if not IsR6 then
							LookAt(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), 
								WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0))
						else	
							LookAt(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor))
						end
					elseif LookBackOnNil then
						LookAt(NeckOrgnC0, WaistOrgnC0)
						if LookingAtValue.Value then
							LookingAtValue.Value = nil
						end
					end
				end
			end)
		elseif LookBackOnNil then
			LookAt(NeckOrgnC0, WaistOrgnC0)
			if LookingAtValue.Value then
				LookingAtValue.Value = nil
			end
		end
	end
end)
-- Signal class


local Signal = {}
Signal.__index = Signal

function Signal.new()
	return setmetatable({
		_handlerListHead = false,
	}, Signal)
end

function Signal:Connect(fn)
	local connection = Connection.new(self, fn)
	if self._handlerListHead then
		connection._next = self._handlerListHead
		self._handlerListHead = connection
	else
		self._handlerListHead = connection
	end
	return connection
end
-- functions



function onRunning(speed)
	if speed>0 then
		pose = "Running"
	else
		pose = "Standing"
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	pose = "Jumping"
end

function onClimbing()
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end

function moveJump()
	RightShoulder.MaxVelocity = 0.5
	LeftShoulder.MaxVelocity = 0.5
	RightShoulder.DesiredAngle = 3.14
	LeftShoulder.DesiredAngle = -3.14 
	RightHip.DesiredAngle = 0
	LeftHip.DesiredAngle = 0
end
------------------------------------------------------------------------



do
	local enabled = false

	local function ToggleFreecam()
		if enabled then
			StopFreecam()
		else
			StartFreecam()
		end
		enabled = not enabled
	end

	local function CheckMacro(macro)
		for i = 1, #macro - 1 do
			if not UserInputService:IsKeyDown(macro[i]) then
				return false
			end
		end
		ToggleFreecam()
		return true
	end

	local function HandleActivationInput(action, state, input)
		if state == Enum.UserInputState.Begin then
			if input.KeyCode == FREECAM_MACRO_KB[#FREECAM_MACRO_KB] then
				CheckMacro(FREECAM_MACRO_KB)
				--[[if CheckMacro(FREECAM_MACRO_KB) then
					return Enum.ContextActionResult.Sink
				end]]
			end
		end
		return Enum.ContextActionResult.Pass
	end

	ContextActionService:BindActionAtPriority("FreecamToggle2", HandleActivationInput, false, TOGGLE_INPUT_PRIORITY, FREECAM_MACRO_KB[#FREECAM_MACRO_KB])
end
--[[OMG YAY! First ever reply system, I'll be doing ALLOT of work on this.. It'll end up to be let's say..
1000+ lines of mixtures of letters forsay? I wanna make this good!]]



hichats = {"Hi","Hello","oh hi","Hi!","Oh hey","Hey","What do you want","What's up"}

local head = script.Parent.Head

function onPlayerEntered(newPlayer)
game.Players.PlayerAdded:connect(onPlayerEntered)
function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
if (msg == "hi") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hi!") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hi.") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello!") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello.") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey!") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey.") then 
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
end
end
game.Players.PlayerAdded:connect(function(newP)
onPlayerEntered(newP) newP.Chatted:connect(function(msg) onChatted(msg, nil, newP) end) end)
--[[ Local Functions ]]

--
function MouseLockController:OnMouseLockToggled()
	self.isMouseLocked = not self.isMouseLocked

	if self.isMouseLocked then
		local cursorImageValueObj: StringValue? = script:FindFirstChild("CursorImage") :: StringValue?
		if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then
			CameraUtils.setMouseIconOverride(cursorImageValueObj.Value)
		else
			if cursorImageValueObj then
				cursorImageValueObj:Destroy()
			end
			cursorImageValueObj = Instance.new("StringValue")
			assert(cursorImageValueObj, "")
			cursorImageValueObj.Name = "CursorImage"
			cursorImageValueObj.Value = DEFAULT_MOUSE_LOCK_CURSOR
			cursorImageValueObj.Parent = script
			CameraUtils.setMouseIconOverride(DEFAULT_MOUSE_LOCK_CURSOR)
		end
	else
		CameraUtils.restoreMouseIcon()
	end

	self.mouseLockToggledEvent:Fire()
end

function MouseLockController:DoMouseLockSwitch(name, state, input)
	if state == Enum.UserInputState.Begin then
		self:OnMouseLockToggled()
		return Enum.ContextActionResult.Sink
	end
	return Enum.ContextActionResult.Pass
end

function MouseLockController:BindContextActions()
	ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input)
		return self:DoMouseLockSwitch(name, state, input)
	end, false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys))
end

function MouseLockController:UnbindContextActions()
	ContextActionService:UnbindAction(CONTEXT_ACTION_NAME)
end

function MouseLockController:IsMouseLocked(): boolean
	return self.enabled and self.isMouseLocked
end

function MouseLockController:EnableMouseLock(enable: boolean)
	if enable ~= self.enabled then

		self.enabled = enable

		if self.enabled then
			-- Enabling the mode
			self:BindContextActions()
		else
			-- Disabling
			-- Restore mouse cursor
			CameraUtils.restoreMouseIcon()

			self:UnbindContextActions()

			-- If the mode is disabled while being used, fire the event to toggle it off
			if self.isMouseLocked then
				self.mouseLockToggledEvent:Fire()
			end

			self.isMouseLocked = false
		end

	end
end

game.Players.LocalPlayer.CharacterAdded:Wait()
return MouseLockController
-- Sets the parent of all cached parts.


function PartCacheStatic:SetCacheParent(newParent: Instance)
	assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("SetCacheParent", "PartCache.new"))
	assert(newParent:IsDescendantOf(workspace) or newParent == workspace, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.")

	self.CurrentCacheParent = newParent
	for i = 1, #self.Open do
		self.Open[i].Parent = newParent
	end
	for i = 1, #self.InUse do
		self.InUse[i].Parent = newParent
	end
end
--	if math.abs(g) > 0 then
--		
--	end


end

F.pbrake = function(x)
	if x then carSeat.PBt:Play()
	else carSeat.PBf:Play()
	end
end

F.updateValue = function(Val, Value)
	if Val then
		Val.Value = Value
	end
end


F.FMSwitch = function(FM)
	if carSeat.Stations.mood.Value == 5 then
		carSeat.Parent.Body.MP.Sound:Stop()
		carSeat.Stations.mood.Value = 2
		scg.Radio.Song.Text = "PRESET 2"
	elseif carSeat.Stations.mood.Value == 2 then
		carSeat.Parent.Body.MP.Sound:Stop()
		carSeat.Stations.mood.Value = 3
		scg.Radio.Song.Text = "PRESET 3"
	elseif carSeat.Stations.mood.Value == 3 then
		carSeat.Parent.Body.MP.Sound:Stop()
		carSeat.Stations.mood.Value = 4
		scg.Radio.Song.Text = "PRESET 4"
	elseif carSeat.Stations.mood.Value == 4 then
		carSeat.Parent.Body.MP.Sound:Stop()
		carSeat.Stations.mood.Value = 1
		scg.Radio.Song.Text = "PRESET 1"
	elseif carSeat.Stations.mood.Value == 1 then
		carSeat.Parent.Body.MP.Sound:Stop()
		carSeat.Stations.mood.Value = 5
		scg.Radio.Song.Text = ""
	end
end

F.volumech = function(v)
	carSeat.Parent.Body.MP.Sound.Volume = v
	scg.Radio.Volume.Text = carSeat.Parent.Body.MP.Sound.Volume
end

F.updateSong = function(Song)
	carSeat.Stations.mood.Value = 5
	carSeat.Parent.Body.MP.Sound:Stop()
	wait()
	carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..Song
	wait()
	carSeat.Parent.Body.MP.Sound:Play()
	scg.Radio.Song.Text = "CUSTOM"
end

F.pauseSong = function()
	carSeat.Stations.mood.Value = 5
	carSeat.Parent.Body.MP.Sound:Stop()
	scg.Radio.Song.Text = "OFF"
end

F.pitc = function(v)
	carSeat.Parent.Body.MP.Sound.Pitch = v
end

script.Parent.OnServerEvent:connect(function(Player, Func, ...)
	if F[Func] then
		F[Func](...)
	end
end)
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS



function onRunning(speed)
	local movedDuringEmote = currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
	local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
	if speed > speedThreshold then
		local scale = 16.0
		playAnimation("walk", 0.2, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
			playAnimation("idle", 0.2, Humanoid)
			pose = "Standing"
		end
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	playAnimation("jump", 0.1, Humanoid)
	jumpAnimTime = jumpAnimDuration
	pose = "Jumping"
end

function onClimbing(speed)
	local scale = 5.0
	playAnimation("climb", 0.1, Humanoid)
	setAnimationSpeed(speed / scale)
	pose = "Climbing"
end

function onGettingUp()
	pose = "GettingUp"
end

function onFreeFall()
	if (jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	end
	pose = "FreeFall"
end

function onFallingDown()
	pose = "FallingDown"
end

function onSeated()
	pose = "Seated"
end

function onPlatformStanding()
	pose = "PlatformStanding"
end