if Player then while wait()do if Player.Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")then local y=script.Parent.Pos.Value local c=script.Parent.CoinPos.Value local T=script.Parent.BodyGyro local F=script.Parent.BodyPosition local E=Player.Character.HumanoidRootPart.Position.Y-script.Parent.Position.Y if script.Parent.Selected.Value==0 then local c=require((game.ReplicatedStorage.Assets.Pets:FindFirstChild(script.Parent.PetName.Value))["\080\101\116 \068\097\116\097"])if c.fly==true then F.Position=(((Player.Character.HumanoidRootPart.Position+y)-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 T.CFrame=CFrame.new(script.Parent.Position,Player.Character.HumanoidRootPart.Position-Vector3.new(0,E,0))else T.CFrame=Player.Character.HumanoidRootPart.CFrame end else F.Position=((Player.Character.HumanoidRootPart.Position+y)-Vector3.new(0,3.4,0))+Vector3.new(0,script.Parent.Size.Y/2,0)if Player.Walking.Value==false then T.CFrame=CFrame.new(script.Parent.Position,Player.Character.HumanoidRootPart.Position-Vector3.new(0,E,0))else T.CFrame=Player.Character.HumanoidRootPart.CFrame end end else F.Position=((workspace.CoinFolder[script.Parent.Selected.Value].Position+c)-Vector3.new(0,workspace.CoinFolder[script.Parent.Selected.Value].Size.Y/2,0))+Vector3.new(0,script.Parent.Size.Y/2,0)T.CFrame=CFrame.new(script.Parent.Position,workspace.CoinFolder[script.Parent.Selected.Value].Position-Vector3.new(0,0,0))end end end end
--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
