Pinkstack/roblox-luau-corpus-text huggingface dataset:
--	humanoid.Torso.Color = teamColor
--	humanoid.Torso.Reflectance = 0.2
--	humanoid.LeftLeg.Color = teamColor
--	humanoid.LeftLeg.Reflectance = 0.2
--	humanoid.RightLeg.Color = teamColor
--	humanoid.RightLeg.Reflectance = 0.1


end

function onTouchHumanoid(humanoid)
	local team = humanoid:findFirstChild("Team", false)
	if team==nil then
		joinTeam(humanoid)
	elseif team.Value~=teamColor then
		-- Harm the enemy!
		humanoid.Health = 0
		return
	end
	
	if not healerIsResting then
		-- Heal the player
		humanoid.Health = humanoid.Health + 50
		coroutine.resume(coroutine.create(restHealer))
	end
end

goingUp = false
function goUp(speed)
	if goingUp then
		return
	end
	goingUp = true
	vel.velocity = Vector3.new(0,speed,0)
	wait(15/speed)
	vel.velocity = Vector3.new(0,-2,0)
	goingUp = false
end

function onTouch(touchedPart)
	-- see if a character touched it
	local parent = touchedPart.Parent
		if parent~=nil then
		local humanoid = parent:findFirstChild("Humanoid", false);
		if humanoid ~= nil then
			onTouchHumanoid(humanoid)
			goUp(10)
			return
		end
	end

	-- change direction
	if touchedPart.Position.y > beacon.Center.Position.y then
		vel.velocity = Vector3.new(0,-2,0)
		goingUp = false
	elseif touchedPart.Position.y < beacon.Center.Position.y then
		goUp(2)
	end
end

function connectPart(part)
	part.Color = teamColor
	part.Touched:connect(onTouch)
end
-----------------------------------------------------------------------------



script.Parent.Humanoid.HealthChanged:Connect(function()
	if script.Parent.Humanoid.Health <= 61 then
		
		Instance.new("Decal", script.Parent["Right Arm"])
		script.Parent["Right Arm"].Decal.Texture = "rbxassetid://508050982"
		script.Parent["Right Arm"].Decal.Face = "Right"
	end
end)
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


function BoostSetup()	
	local Speedometer = gui:WaitForChild("Speedometer")
	local Bar = Speedometer:WaitForChild("Bar")
	local SpeedBar = Bar:WaitForChild("SpeedBar")

	function GuiController:UpdateBoost(boostAmount)
		local boostPercentage = math.clamp(boostAmount/engine._settings.BoostAmount, 0, 1)
		Bar.Position = UDim2.new(-1 + boostPercentage, 0, 0, 0)
		SpeedBar.Position = UDim2.new(1 - 1*boostPercentage, 0, 0, 0)
	end
end -- BoostSetup()
--For tires:


for i,child in pairs(script.Parent.Parent:GetChildren()) do
	if string.find(child.Name, "FR") then FRtire = child.PhysicsTire
	elseif string.find(child.Name, "FL") then FLtire = child.PhysicsTire
	elseif string.find(child.Name, "RR") then RRtire = child.PhysicsTire
	elseif string.find(child.Name, "RL") then RLtire = child.PhysicsTire
	end
end
local frontDistance = (script.Parent.Parent.Base.Position - FRtire.Position).magnitude + 0.5
local rearDistance = (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude + 0.5
function deleteCar()
	print"Deleting car fling"
	script.Parent.Parent.Parent:Destroy()
end


thrust.Force = Vector3.new(0,0,0)

seat.Changed:Connect(function()
if not inLoop then
	inLoop = true
	repeat wait(0.3) 
		local speed = seat.Velocity.Magnitude

		if speed > 90 and seat.Occupant ~= nil then
			 factor = (55/speed) * factorMain--

		elseif speed > 60 and speed <= 90 and seat.Occupant ~= nil then
			 factor = (51/speed) * factorMain--

		elseif speed > 30 and speed <= 60 and seat.Occupant ~= nil then
			 factor = (47/speed) * factorMain--

		elseif speed > 10 and speed <= 30 and seat.Occupant ~= nil then
			 factor = (40/speed) * factorMain--

		elseif speed < 10 and speed <= 1 and seat.Occupant ~= nil then
			 factor = (0.9) * factorMain--

		elseif speed < 30 and seat.Occupant == nil then
			 factor = (0.5) * factorMain--

		end


		if speed > maxSpeed + 2 then factor = factorMain/2 end

		if seat.Throttle == -1 then factor = factor * -1
		elseif seat.Throttle == 1 then factor = factor/2 end

		thrust.Force = Vector3.new(0,0,(400*speed*factor))
		--print (speed,thrust.Force)

		--For tires
		if (script.Parent.Parent.Base.Position - FRtire.Position).magnitude > frontDistance then wait(1)if (script.Parent.Parent.Base.Position - FRtire.Position).magnitude > frontDistance then deleteCar() end end
		if (script.Parent.Parent.Base.Position - FLtire.Position).magnitude > frontDistance then wait(1) if (script.Parent.Parent.Base.Position - FLtire.Position).magnitude > frontDistance then deleteCar() end end
		if (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude > rearDistance then wait(1)if  (script.Parent.Parent.Rear.Position - RRtire.Position).magnitude > rearDistance then deleteCar() end end
		if (script.Parent.Parent.Rear.Position - RLtire.Position).magnitude > rearDistance then wait(1)if (script.Parent.Parent.Rear.Position - RLtire.Position).magnitude > rearDistance then  deleteCar() end end
		
	until speed < 1
	inLoop = false
end
end)
--//SHADZYDEV//--


local team = script.Parent.Team
local frame = script.Parent.Parent
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
 frame.Visible = false
 player.Team = team.Value
 game.Lighting.Blur.Size = 0
 workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)
------------------------------------------------------


	--========================SPOTLIGHT========================--

	local SpotLightEvent = script.Parent.Car.Value.Body.Spotlight.RemoteEvent
	
	SpotlightFrame.On.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Lights on")script.Parent.AC6_Stock_Gauges.Frame.Beep:Play()end)
	SpotlightFrame.Off.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Lights off")script.Parent.AC6_Stock_Gauges.Frame.Beep:Play()end)
	
	SpotlightFrame.Right.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Right start")end)
	SpotlightFrame.Right.MouseButton1Up:Connect(function()SpotLightEvent:FireServer("Right stop")end)
	
	SpotlightFrame.Left.MouseButton1Down:Connect(function()SpotLightEvent:FireServer("Left start")end)
	SpotlightFrame.Left.MouseButton1Up:Connect(function()SpotLightEvent:FireServer("Left stop")end)	
	
	--======================SPOTLIGHT END======================--
------------------------------------------------------------------------------------------------------------------------------------------------------
--  ControlScript
------------------------------------------------------------------------------------------------------------------------------------------------------



local Players 				= game:GetService('Players')
local RunService 			= game:GetService('RunService')
local UserInputService 		= game:GetService('UserInputService')
local ReplicatedStorage 	= game:GetService('ReplicatedStorage')
local PathfindingService 	= game:GetService('PathfindingService')

local LocalPlayer 			= Players.LocalPlayer
local LocalMouse 			= LocalPlayer:GetMouse()
local LocalCharacter 		= LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()

local MouseHolding 			= false
local PathingThread 		= nil
local CurrentPath 			= nil
local HoldingPosition 		= false

workspace.Camera.CameraType = Enum.CameraType.Custom
--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.Boomerang -- 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)
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,VRecoil = {16,20}				--- Vertical Recoil
	,HRecoil = {8,12}				--- Horizontal Recoil
	,AimRecover = .325				---- Between 0 & 1
	
	,RecoilPunch = .25
	,VPunchBase = 4.75				--- Vertical Punch
	,HPunchBase = 2.5				--- Horizontal Punch
	,DPunchBase = 1 				--- Tilt Punch | useless
	
	,AimRecoilReduction = 5 		--- Recoil Reduction Factor While Aiming (Do not set to 0)
	,PunchRecover = 0.2
	,MinRecoilPower = .75
	,MaxRecoilPower = 2
	,RecoilPowerStepAmount = .25
	
	,MinSpread = 0.12				--- Min bullet spread value | Studs
	,MaxSpread = 30					--- Max bullet spread value | Studs
	,AimInaccuracyStepAmount = .15
	,WalkMultiplier = 0				--- Bullet spread based on player speed

	,SwayBase = 0.25				--- Weapon Base Sway | Studs
	,MaxSway =	3					--- Max sway value based on player stamina | Studs
--


script.Parent.basla.MouseButton1Click:Connect(function()
	game.Lighting.Blur.Size = 0
	workspace.CurrentCamera.CameraType = "Custom"
	script.Parent.Parent.Parent.Envanter.Enabled = true
	script.Parent.Parent.Shad.Enabled = true
	game.SoundService.Music:Play()
	--
	script.Parent:Destroy()
end)
--Character Script
--Unless you know what you're doing, do not modify this script.


local tool = script.Tool.Value --This identifies the tool to perform actions on.
local player = script.Player.Value --This identifies the player of the character this script is inside.
if player ~= nil then --This ensures that the player exists.
	local humanoidrootpart = script.Parent:WaitForChild("HumanoidRootPart") --This identifies the HumanoidRootPart inside the character.
	player.CharacterRemoving:Connect(function() --This detects the removal of the character.
		tool.Handle.CFrame = CFrame.new(humanoidrootpart.Position) --This sets the position of the handle to the character's position.
		tool.Parent = workspace --This puts the tool into Workspace, allowing players to pick it up.
	end)
else --If the player doesn't exist, the following code will run instead.
	script:Destroy() --This removes this script.
end
--[[
	ServerPlayer state for when the player is using the camera system.
]]


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

local MonsterManager = require(ServerStorage.Source.Managers.MonsterManager)

local LeaveCamera = ReplicatedStorage.Remotes.LeaveCamera

local NOISE_GENERATED = 50

local connections = {}
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 468		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 4500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 5			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--	====================
--	BASIC
--	A basic settings for the gun
--	====================


	
		UseCommonVisualEffects = false; --Enable to use default visual effect folder named "Common". Otherwise, use visual effect with specific tool name (ReplicatedStorage -> Miscs -> GunVisualEffects)
		AutoReload = false; --Reload automatically when you run out of mag; disabling it will make you reload manually
		CancelReload = true; --Exit reload state when you fire the gun
		DirectShootingAt = "None"; --"FirstPerson", "ThirdPerson" or "Both". Make bullets go straight from the fire point instead of going to input position. Set to "None" to disable this
	
	 	--Check "DualWeldEnabled" for detail
		PrimaryHandle = "Handle";
		SecondaryHandle = "Handle2";
	
		CustomGripEnabled = false; --NOTE: Must disable "RequiresHandle" first
		CustomGripName = "Handle";
		CustomGripPart0 = {"Character", "Right Arm"}; --Base
		CustomGripPart1 = {"Tool", "Handle"}; --Target
		AlignC0AndC1FromDefaultGrip = true;
		CustomGripCFrame = false;
		CustomGripC0 = CFrame.new(0, 0, 0);
		CustomGripC1 = CFrame.new(0, 0, 0);	
		
		--CustomGripPart[0/1] = {Ancestor, InstanceName}
		--Supported ancestors: Tool, Character
		--NOTE: Don't set "CustomGripName" to "RightGrip"
-- Changes the body orientiation to make it face a given direction. Returns the computed angles


function OrientableBody:face(direction: Vector3): Vector2?
	local humanoid: Humanoid? = self.character and self.character:FindFirstChild("Humanoid")
	if not humanoid or not humanoid.RootPart then
		return nil
	end

	direction = self.character.HumanoidRootPart.CFrame:PointToObjectSpace(self.character.HumanoidRootPart.Position + direction)

	local verticalAngle = math.asin(direction.Y)
	if verticalAngle < Constants.OFFSET_Y and verticalAngle > -Constants.OFFSET_Y then
		-- Vertical angle is within dead zone, do not change head orientation
		verticalAngle = 0
	else
		if verticalAngle > 0 then
			verticalAngle = verticalAngle - Constants.OFFSET_Y
		else
			verticalAngle = verticalAngle + Constants.OFFSET_Y
		end
	end

	local horizontalAngle = math.atan2(-direction.X, -direction.Z)
	-- If looking behind the character, it will instead rotate towards the camera
	if horizontalAngle > math.pi / 2 then
		horizontalAngle = math.pi - horizontalAngle
	elseif horizontalAngle < -math.pi / 2 then
		horizontalAngle = -math.pi - horizontalAngle
	end

	self.motor:setGoal({
		horizontalAngle = Otter.spring(horizontalAngle),
		verticalAngle = Otter.spring(verticalAngle),
	})

	return Vector2.new(horizontalAngle, verticalAngle)
end
--------------------------------------------------------------------------------------
--------------------[ VARIABLES ]-----------------------------------------------------
--------------------------------------------------------------------------------------



local Selected = false

local Idleing = false
local Walking = false
local Running = false

local Aimed = false
local Aiming = false

local Reloading = false
local BreakReload = false

local Knifing = false
local ThrowingGrenade = false

local MB1_Down = false

local CanFire = true

local KnifeReady = true

local CanRun = true
local RunTween = false
local Run_Key_Pressed = false
local ChargingStamina = false

local AimingIn = false
local AimingOut = false

local Stamina = S.SprintTime * 60
local CurrentSteadyTime = S.ScopeSteadyTime * 60

local CameraSteady = false
local TakingBreath = false

local Grip = nil
local Aimed_GripCF = nil

local Gui_Clone = nil

local CurrentSpread = S.Spread.Hipfire
local CurrentRecoil = S.Recoil.Hipfire

local AmmoInClip = 0

local Stance = 0
local StanceSway = 1
local CameraSway = 1

local HeadRot = 0
local ArmTilt = 0

local LastBeat = 0

local Parts = {}

local Connections = {}

local PrevNeckCF = {
	C0 = nil;
	C1 = nil;
}

local Keys = {}
-- CONSTANTS



local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local Defaults = GuiLib:WaitForChild("Defaults")

local UIS = game:GetService("UserInputService")
local RUNSERVICE = game:GetService("RunService")
local CONSTANTS = require(script:WaitForChild("CONSTANTS"))

local PI = math.pi
local TAU = CONSTANTS.TAU
local EX_OFFSET = CONSTANTS.EX_OFFSET

local GAMEPAD_CLICK = {
	[Enum.KeyCode.ButtonA] = true
}

local MOUSE_GROUP = {
	[Enum.UserInputType.MouseButton1] = true,
	[Enum.UserInputType.MouseMovement] = true,
	[Enum.UserInputType.Touch] = true
}

local GAMEPAD_GROUP = {
	[Enum.UserInputType.Gamepad1] = true,
	[Enum.UserInputType.Gamepad2] = true,
	[Enum.UserInputType.Gamepad3] = true,
	[Enum.UserInputType.Gamepad4] = true,
	[Enum.UserInputType.Gamepad5] = true,
	[Enum.UserInputType.Gamepad6] = true,
	[Enum.UserInputType.Gamepad7] = true,
	[Enum.UserInputType.Gamepad8] = true
}

local CreateRadial = require(script:WaitForChild("CreateRadial"))
--- Recalculate the window height


function Window:UpdateWindowHeight()
	local numLines = 0

	for _, child in pairs(Gui:GetChildren()) do
		if child:IsA("GuiObject") then
			numLines = numLines + 1
		end
	end

	local windowHeight = (numLines * LINE_HEIGHT) + 20

	Gui.CanvasSize = UDim2.new(Gui.CanvasSize.X.Scale, Gui.CanvasSize.X.Offset, 0, windowHeight)
	Gui.Size =
		UDim2.new(
		Gui.Size.X.Scale,
		Gui.Size.X.Offset,
		0,
		windowHeight > WINDOW_MAX_HEIGHT and WINDOW_MAX_HEIGHT or windowHeight
	)

	Gui.CanvasPosition = Vector2.new(0, math.clamp(windowHeight - 300, 0, math.huge))
end
--run this first so if there is a 'white' team it is switched over


if not Settings['AutoAssignTeams'] then
	local teamHire = Instance.new('Team', Teams)
	teamHire.TeamColor = BC.new('White')
	teamHire.Name = "FOR HIRE"
end

for i,v in pairs(script.Parent:WaitForChild('Tycoons'):GetChildren()) do
	Tycoons[v.Name] = v:Clone() -- Store the tycoons then make teams depending on the tycoon names
	if returnColorTaken(v.TeamColor) then
		--//Handle duplicate team colors
		local newColor;
		repeat
			wait()
			newColor = BC.Random()
		until returnColorTaken(newColor) == false
		v.TeamColor.Value = newColor
	end
	--Now that there are for sure no duplicates, make your teams
	local NewTeam = Instance.new('Team',Teams)
	NewTeam.Name = v.Name
	NewTeam.TeamColor = v.TeamColor.Value
	if not Settings['AutoAssignTeams'] then
		NewTeam.AutoAssignable = false
	end
	v.PurchaseHandler.Disabled = false
end

function getPlrTycoon(player)
	for i,v in pairs(script.Parent.Tycoons:GetChildren()) do
		if v:IsA("Model") then
			if v.Owner.Value == player then
				return v
			end
		end
	end
	return nil
end

game.Players.PlayerAdded:connect(function(player)
	local plrStats = Instance.new("NumberValue",game.ServerStorage.PlayerMoney)
	plrStats.Name = player.Name
	local isOwner = Instance.new("ObjectValue",plrStats)
	isOwner.Name = "OwnsTycoon"
end)

game.Players.PlayerRemoving:connect(function(player)
	local plrStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
	if plrStats ~= nil then
		plrStats:Destroy()
	end
	local tycoon = getPlrTycoon(player)
	if tycoon then
		local backup = Tycoons[tycoon.Name]:Clone()
		tycoon:Destroy()
		wait()
		backup.Parent=script.Parent.Tycoons
	end
end)
--	====================
--	BASIC
--	A basic settings for the gun
--	====================


	
		UseCommonVisualEffects = true; --Enable to use default visual effect folder named "Common". Otherwise, use visual effect with specific tool name (ReplicatedStorage -> Miscs -> GunVisualEffects)
		AutoReload = true; --Reload automatically when you run out of mag; disabling it will make you reload manually
		CancelReload = true; --Exit reload state when you fire the gun
		DirectShootingAt = "None"; --"FirstPerson", "ThirdPerson" or "Both". Make bullets go straight from the fire point instead of going to input position. NOTE: Set to "None" to disable this
	
		--Check "DualWeldEnabled" for detail
		PrimaryHandle = "Handle";
		SecondaryHandle = "Handle2";
	
		CustomGripEnabled = false; --NOTE: Must disable "RequiresHandle" first
		CustomGripName = "Handle";
		CustomGripPart0 = {"Character", "Right Arm"}; --Base
		CustomGripPart1 = {"Tool", "Handle"}; --Target
		AlignC0AndC1FromDefaultGrip = true;
		CustomGripCFrame = false;
		CustomGripC0 = CFrame.new(0, 0, 0);
		CustomGripC1 = CFrame.new(0, 0, 0);	
		
		--CustomGripPart[0/1] = {Ancestor, InstanceName}
		--Supported ancestors: Tool, Character
		--NOTE: Don't set "CustomGripName" to "RightGrip"
-- Setup animation objects


function scriptChildModified(child)
	local fileList = animNames[child.Name]
	if fileList then
		configureAnimationSet(child.Name, fileList)
	end	
end

script.ChildAdded:connect(scriptChildModified)
script.ChildRemoved:connect(scriptChildModified)

for name, fileList in pairs(animNames) do 
	configureAnimationSet(name, fileList)
end
--[=[
	@param object T
	Add an object to the queue.
]=]


function TaskQueue:Add<T>(object: T)
	table.insert(self._queue, object)
	if not self._flushingScheduled then
		self._flushingScheduled = true
		task.defer(function()
			if not self._flushingScheduled then
				return
			end
			self._flushing = true
			self._onFlush(self._queue)
			table.clear(self._queue)
			self._flushing = false
			self._flushingScheduled = false
		end)
	end
end
--[=[
	Gets the controller by name. Throws an error if the controller
	is not found.
]=]


function KnitClient.GetController(controllerName: string): Controller
	local controller = controllers[controllerName]
	if controller then
		return controller
	end
	assert(started, "Cannot call GetController until Knit has been started")
	assert(type(controllerName) == "string", `ControllerName must be a string; got {type(controllerName)}`)
	error(`Could not find controller "{controllerName}". Check to verify a controller with this name exists.`, 2)
end
--!strict


type Match = {
	index: number,
	match: string,
}

local function findOr(str: string, patternTable: { string }, initIndex: number?): Match | nil
	-- loop through all options in patern patternTable

	local init = utf8.offset(str, initIndex or 1)
	local matches = {}
	for _, value in ipairs(patternTable) do
		local iStart, iEnd = string.find(str, value, init)
		if iStart then
			local prefix = string.sub(str, 1, iStart - 1)
			local prefixEnd, invalidBytePosition = utf8.len(prefix)
			if prefixEnd == nil then
				error(("string `%s` has an invalid byte at position %s"):format(prefix, tostring(invalidBytePosition)))
			end
			local iStartIndex = prefixEnd :: number + 1
			local match = {
				index = iStartIndex,
				match = string.sub(str, iStart, iEnd),
			}
			table.insert(matches, match)
		end
	end

	-- if no matches, return nil
	if #matches == 0 then
		return nil
	end

	-- find the first matched index (after the init param)
	-- for each, if we get a hit, return the earliest index and matched term

	local firstMatch
	for _, value in ipairs(matches) do
		-- load first condition
		if firstMatch == nil then
			firstMatch = value
		end
		-- identify if current match comes before first match
		if value.index < firstMatch.index then
			firstMatch = value
		end
	end

	-- return first match
	return firstMatch
end

return findOr
--local Anim = script.Parent.AnimationController:LoadAnimation(game.ReplicatedStorage.Pets.Settings.WalkAnim)
--local AnimPlay = false



if Player then
	while wait() do
		if Player.Character:FindFirstChild("HumanoidRootPart") then
			local Pos = script.Parent.Pos.Value
			local CoinPos = script.Parent.CoinPos.Value
			local BG = script.Parent.BodyGyro
			local BP = script.Parent.BodyPosition
			local d = Player.Character.HumanoidRootPart.Position.Y - script.Parent.Position.Y
			if script.Parent.Selected.Value == 0 then
				local Stats = require(game.ReplicatedStorage.Assets.Pets:FindFirstChild(script.Parent.PetName.Value)["Pet Data"])
				if Stats.fly == true then
					BP.Position = (Player.Character.HumanoidRootPart.Position + Pos) - Vector3.new(0,2,0) + Vector3.new(0,script.Parent.Size.Y/2,0) + Vector3.new(0, game.ServerScriptService.globalPetFloat.Value, 0)
					if Player.Walking.Value == false then
						BG.CFrame = CFrame.new(script.Parent.Position, Player.Character.HumanoidRootPart.Position - Vector3.new(0, d, 0))
					else
						BG.CFrame = Player.Character.HumanoidRootPart.CFrame
					end
				else
					BP.Position = (Player.Character.HumanoidRootPart.Position + Pos) - Vector3.new(0,3.4,0) + Vector3.new(0,script.Parent.Size.Y/2,0)
					if Player.Walking.Value == false then
						BG.CFrame = CFrame.new(script.Parent.Position, Player.Character.HumanoidRootPart.Position - Vector3.new(0, d, 0))
					else
						BG.CFrame = Player.Character.HumanoidRootPart.CFrame
					end
				end
			else
				BP.Position = (workspace.CoinFolder[script.Parent.Selected.Value].Position + CoinPos) - Vector3.new(0,workspace.CoinFolder[script.Parent.Selected.Value].Size.Y/2,0) + Vector3.new(0,script.Parent.Size.Y/2,0)
				BG.CFrame = CFrame.new(script.Parent.Position, workspace.CoinFolder[script.Parent.Selected.Value].Position - Vector3.new(0, 0, 0))
			end
		end
	end
end